in reply to Re: new to perl, syntax question
in thread new to perl, syntax question
suppose you have @a= qw(1 2 3 4);
you are writting print "\n @a"; this will print 1 2 3 4.
if you are trying to write like...
$p= @a, then it will give you count of array i.e. 4
so it does not mean that if we write @a as index inside array would give the value of 4th index of array. Basically if we write code..
$b[@a] with return nothing because bare @a return complete set of value which is not a valid index and that is passing as index in @b so of course will return blank.
you are writting print "\n @a"; this will print 1 2 3 4.
if you are trying to write like...
$p= @a, then it will give you count of array i.e. 4
so it does not mean that if we write @a as index inside array would give the value of 4th index of array. Basically if we write code..
$b[@a] with return nothing because bare @a return complete set of value which is not a valid index and that is passing as index in @b so of course will return blank.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: new to perl, syntax question
by Marshall (Canon) on Feb 20, 2012 at 12:52 UTC |
In Section
Seekers of Perl Wisdom