The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Data::Stack - A Stack!

SYNOPSIS

  use Data::Stack;
  my $stack = new Data::Stack();

DESCRIPTION

Quite simple, really. Just a stack implemented via an array.

METHODS

new( [ @ITEMS ] )

Creates a new Data::Stack. If passed an array, those items are added to the stack.

peek()

Returns the item at the top of the stack but does not remove it.

get($INDEX)

Returns the item at position $INDEX in the stack but does not remove it. 0 based.

count()

Returns the number of items in the stack.

empty()

Returns a true value if the stack is empty. Returns a false value if not.

clear()

Completely clear the stack.

pop()

Removes the item at the top of the stack and returns it.

push($item)

Adds the item to the top of the stack.

EXPORT

None by default.

SEE ALSO

There are various Stack packages out there but none of them seemed simple enough. Here we are!

AUTHOR

Cory Watson, <cpan@onemogin.com>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Cory Watson

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.