Pablo Wolter wrote:
> [EMAIL PROTECTED] wrote:
> 
> 
>>Hi All 
>>
>>Prob: I want to convert all the elememts of an array to ascalor variable that 
>>I can use latter on in my code 
>>e.g. 
>>
>>my @array=qw/balli johney bobby/;
>>now here i need 3 different variable with the above values i.e.
>>my $name1=balli ;
>>my $name2=johney ;
>>my $name3=bobby ;
>>
>>Soln so far: 
>>
>>my ($i) ;
>>for ($i=0; $i<@array;$i++)
>>{
>>$name=$array[$i] ; # lost here is to how to have different $name each time 
>>also how can make these 
>>
> 
> my $i;
> for ($i=0; $i<@arrayl $i++) {
>     $name$i=$array[$i];
> }
> 
> That way you don't need to know in advance how many $name variables you
> need.
>

After fixing the typo at the end of @array, I still end up with:

"Scalar found where operator expected at ./test.pl line 16, near "$name$i"
        (Missing operator before $i?)
syntax error at ./test.pl line 16, near "$name$i"
Execution of ./test.pl aborted due to compilation errors."

Make sure to test before posting.

http://danconia.org

[snip]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to