Example 8-7. examples/arrays/queue.pl
#!/usr/bin/perl
use strict;
use warnings;
my @people = ("Foo", "Bar");
while (@people) {
my $next_person = shift @people;
print "$next_person\n"; # do something with this person
print "Type in more people:";
while (my $new = <STDIN>) {
chomp $new;
push @people, $new;
}
print "\n";
}
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| shift, unshift | Up | shift |