Answered step by step
Verified Expert Solution
Question
1 Approved Answer
****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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started