How to slice a split directly?

2004-09-23 Thread Siegfried Heintze
This works and does what I want it to: perl -e '@x = split(\\., a.b.c); print $x[0];' Why does not this work? perl -e 'print @{split(\\., a.b.c)}[0];' Is there a compact way to take a slice of a split (or other function that returns an array) without creating a temporary variable? Thanks,

Re: How to slice a split directly?

2004-09-23 Thread William Gunther
On Thu, 23 Sep 2004 13:43:08 -0600, Siegfried Heintze [EMAIL PROTECTED] wrote: This works and does what I want it to: perl -e '@x = split(\\., a.b.c); print $x[0];' Why does not this work? perl -e 'print @{split(\\., a.b.c)}[0];' Because split doesn't return an array reference, it

Re: How to slice a split directly?

2004-09-23 Thread Jenda Krynicky
From: Siegfried Heintze [EMAIL PROTECTED] This works and does what I want it to: perl -e '@x = split(\\., a.b.c); print $x[0];' Why does not this work? perl -e 'print @{split(\\., a.b.c)}[0];' Is there a compact way to take a slice of a split (or other function that returns an array)

Re: How to slice a split directly?

2004-09-23 Thread Wiggins d Anconia
This works and does what I want it to: perl -e '@x = split(\\., a.b.c); print $x[0];' Why does not this work? perl -e 'print @{split(\\., a.b.c)}[0];' Is there a compact way to take a slice of a split (or other function that returns an array) without creating a temporary variable?

Re: How to slice a split directly?

2004-09-23 Thread Jenda Krynicky
From: Wiggins d Anconia [EMAIL PROTECTED] This works and does what I want it to: perl -e '@x = split(\\., a.b.c); print $x[0];' Why does not this work? perl -e 'print @{split(\\., a.b.c)}[0];' Is there a compact way to take a slice of a split (or other function that returns