tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
11
Task/Queue-Usage/Perl/queue-usage-1.pl
Normal file
11
Task/Queue-Usage/Perl/queue-usage-1.pl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@queue = (); # we will simulate a queue in a array
|
||||
|
||||
push @queue, (1..5); # enqueue numbers from 1 to 5
|
||||
|
||||
print shift @queue,"\n"; # dequeue
|
||||
|
||||
print "array is empty\n" unless @queue; # is empty ?
|
||||
|
||||
print $n while($n = shift @queue); # dequeue all
|
||||
print "\n";
|
||||
print "array is empty\n" unless @queue; # is empty ?
|
||||
Loading…
Add table
Add a link
Reference in a new issue