How to make the following assignment, as arrayreference
assignment ?

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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain arrays in perl.

710


Explain 'grep' function.

743


what are prefix dereferencer and list them out?

790


What is perl I used for?

728


What is epoch time in perl?

679


“The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?

773


What is the function of virtual documents in cgi programs?

720


For a situation in programming, how can you determine that Perl is a suitable?

656


What are stdin, stdout and stderr?

683


What is the use of -t?

729


What's the difference between /^Foo/s and /^Foo/?

751


How do I sort a hash by the hash key?

730


what are the two ways to get private values inside a subroutine or block?

693


How do you set environment variables in perl?

730


Explain different types of perl operators.

698