[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [perl] anonym array reference..



I sslug.programmering, skrev Jesper Krogh:
>  Hvordan laver man en anonym array reference i perl? 
> 
>  Jeg havde troet at dette virkede:
>  sslug@sslug:~$ perl -e'foreach(@{test()}){ print $_ . "\n"; }; sub
>  test { return \(qw(one two));}'
>  Not an ARRAY reference at -e line 1.
> 
>  Men hvis jeg giver den et navn, så virker den fint:
>  sslug@sslug:~$ perl -e'foreach(@{test()}){ print $_ . "\n"; }; sub
>  test { my @arr = qw(one two); return sslug@sslug;}'
>  one
>  two

Og straks efter kom svaret fra "shj" på IRC:
sslug@sslug:~$ perl -we'foreach(@{test()}){ print $_ . "\n"; }; sub
test { return [qw(one two)];}'
one
two

Jesper
-- 
./Jesper Krogh, sslug@sslug, Jabber ID: sslug@sslug



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-12-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *