How to make the following assignment, as arrayreference
assignment ?

my $arr_ref='[1,2,3,4,4,'elem']';

Answers were Sorted based on User's Feedback



How to make the following assignment, as arrayreference assignment ? my $arr_ref='[1,2,3,4,..

Answer / kiruthikau

Refer this program.
[code]
my $ref=[1,2,3,4];
print ref $ref;
[/code]

Is This Answer Correct ?    0 Yes 0 No

How to make the following assignment, as arrayreference assignment ? my $arr_ref='[1,2,3,4,..

Answer / kiruthikau

my $ref=[1,2,3,4];
print ref $ref;

ref will return the type of reference.
In this case ref will return as 'ARRAY'.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More CGI Perl Interview Questions

What exactly is grooving and shortening of the array?

0 Answers  


Consider the following example #! /bin/perl use strict; sub sample { my @arr=(1,2,3,4); return @arr; } my ($a,$b,$c,$d) = &sample; print "$a\n$b\n$c\n$d\n"; In the above code, How can I get the $c without using the arguments such as $a,$b. I don't want to use any array to get the return values.

2 Answers  


How does polymorphism work in perl?

0 Answers  


What are the different instances used in cgi overhead?

0 Answers  


What are numeric operators in perl?

0 Answers  


What happens when you return a reference to a private variable?

0 Answers  


How to read a single line from a file in perl?

0 Answers  


How to concatenate strings in perl?

0 Answers  


Define print() function in perl?

0 Answers  


What does init 5 and init 0 do?

0 Answers  


What is the purpose of “_file_ literal” and “_line_ literal” in perl?

0 Answers  


Why to use perl scripting?

0 Answers  


Categories