Question: ****Rewrite your pez.pl program to use 2 loops and an array for holding the input. This is my past assignment that I did and now
****Rewrite your pez.pl program to use 2 loops and an array for holding the input.
This is my past assignment that I did and now I have to use 2 loops and an array for holding the input. I need help. Or give me an example.
#!/usr/bin/perl use warnings; #Initializing Pez dispenser my @flavor = (); #Pez dispenser is empty print "Pez dispenser is empty: @flavor "; #Getting 10 flavors for(my $i = 0; $i<10; $i++) { print "Give me a flavor: "; my $baz= ; chomp $baz; push @sabor, $baz; } print " "; #Pushing flavors print "Pushing my flavors @sabor "; print " "; #Pez dispenser is full print "Dispenser is full "; #printing flavors one a time for($i = 0; $i<10; $i++) { pop(@sabor); print "@sabor "; } #Pez dispenser is empty print "Pez dispenser is empty again ";
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
