You want to print the contents of an entire array. How would you do that?



You want to print the contents of an entire array. How would you do that?..

Answer / Anita Gautam

To print the contents of an entire array in Perl, you can use a for loop or the map function. Here's an example using a for loop:
```perl
my @array = (1, 2, 3, 4, 5);
for my $element (@array) {
print "$elementn";
}
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

Why -w argument is used with perl programs?

1 Answers  


Packing and Unpacking. Hi, I want to get output as 0x23400000345.... in the below example How to get? i tried out, but unable to get the answer $r=0x234; $t=0x345; $y=pack('L L',$t,$r); $x1=unpack('L!',pack('P',$y)); printf("\nThe value is $x1"); I didn't get constant output

1 Answers  


How can arrays be tied?

1 Answers  


How to close a file in perl?

1 Answers  


what are the strategies followed for multiple form interaction in cgi programs?

1 Answers  


How do you you check the return code of a command in perl?

1 Answers   HCL,


What is the use of strict?

1 Answers  


How can you replace the characters from a string and save the number of replacements?

1 Answers  


How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.

1 Answers  


How to check the status of airplane mode (enable/disable) in perl for Android mobile?

1 Answers  


What is the difference between for & foreach, exec & system?

9 Answers   Photon, Wipro,


How do I replace every TAB character in a file with a comma?

1 Answers  


Categories