Tomtom has asked for the wisdom of the Perl Monks concerning the following question:
Hello, everyone,
I'm new to Perl, so my question might seem a bit stupid. Here goes : I had a question about list contexts : how comes
doesn't work ? I thought that the comma would tell print that it's in a list context, but it seems it doesn't work because of the braces around the split.print (split "\t", $line)[0], "\n" ;
The only way I found to make this work is
or print ( (split "\t", $line)[0], "\n" );print ( (split "\t", $line)[0] ), "\n" ;
Thanks for your answers
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about list context
by tlm (Prior) on Apr 14, 2005 at 13:49 UTC | |
by rir (Vicar) on Apr 14, 2005 at 16:17 UTC | |
|
Re: Question about list context
by rev_1318 (Chaplain) on Apr 14, 2005 at 13:50 UTC | |
|
Re: Question about list context
by ikegami (Patriarch) on Apr 14, 2005 at 14:04 UTC | |
|
Re: Question about list context
by polettix (Vicar) on Apr 14, 2005 at 14:17 UTC | |
|
Re: Question about list context
by eXile (Priest) on Apr 14, 2005 at 14:24 UTC | |
by chromatic (Archbishop) on Apr 14, 2005 at 17:28 UTC |