Question: Need help with perl script, using perl 5 on windows Someone please check my answers. If incorrect please provide an answer but please explain how

Need help with perl script, using perl 5 on windows

Someone please check my answers. If incorrect please provide an answer but please explain how you got the answer. self studying for perl certification

My answers after questions

Questions

Exercise B6

Show the value of the array after the execution of the following program segment:

@x = (4 , 5 , 6 , 7 , 2) ;

push(@x , @x[2,3]) ;

unshift (@x , $x[2]) ;

unshift (@x , $x[3]) ;

pop (@x) ;

Exercise B7

Show the value of the arrays after the execution of the following program segment:

@x = (14 , 15 , 6 , 17 , 12 , 10 , 8 , 20 , 22) ;

@y = splice (@x , 2 , 2) ;

@x = (@x , @y) ;

splice (@x , 2 , 2 ) ;

Exercise B8

What would be printed from the following program segment?

 $\ = "##" ; $, = "?" ; @x = (2, 3, 4, 5, 6, 7) ; print ("@x" , "@x") ; 

Exercise B9

What would he printed from the following program segment?

 while ( (2, 5, 1) - 1) { print ("hello ") ; } 

Exercise B10

What would he printed from the following program segment?

 @x = (3, 4, 8, 10) ; foreach (@x) { print ("hello ") ; } 

Exercise B11

What would he printed from the following program segment?

 foreach (2 , 4 , 6 , 8 , 10 , 12 , 14) { if($_ > 10 ) { print ("$_ ") ; } last ; } 

Exercise B12

What would he printed from the following program segment?

 foreach (2 , 4 , 6 , 8 , 10 , 12 , 9 , 14) { if($_ > 10 ) { next ; } print ("$_ ") ; } 

Exercise B13

What would he printed from the following program segment?

 $x = 1 ; { print ("$x ") ; $x++ ; if ($x > 7) { last ; } redo ; } 

Exercise B14

What would he printed from the following program segment?

 @x = (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10) ; foreach (@x) { $x = pop (@x) ; $y = shift (@x) ; print ("$x $y ") ; } 

Exercise B15

What would he printed from the following program segment?

 @x = (1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10) ; foreach (@x) { $x = pop (@x) ; $x = shift (@x) ; push (@x, $x) ; } print ("@x ") ; 

MY ANSWERS (inserted into a compiler)

Exercise B6

ran the script and got no output. Is that correct? if so what is that called?

Exercise B7

ran the script and got no output. Is that correct? if so what is that called?

Exercise B8

2 3 4 5 6 7?2 3 4 5 6 7##

Exercise B9

ran the script and got no output. Is that correct? if so what is that called?

Exercise B10

hello

hello

hello

hello

Exercise B11

ran the script and got no output. Is that correct? if so what is that called?

Exercise B12

2

4

6

8

10

9

Exercise B13

1

2

3

4

5

6

7

Exercise B14

10 1

9 2

8 3

7 4

Exercise B15

6 7 8 9 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!