in reply to Re: variation on splitting a string into elements of an array
in thread splitting a sequence using unpack

Why these two lines:
my $template = "a" x $left_out ; shift @array while($left_out--);
When you could easily use this one line instead: (and earlier responses had used the "x" template character, and you'd clearly read those earlier responses)
my $template = "x$left_out" ;
This also has the advantage that you don't trash $left_out, in case you need it later. Of course, if you're using a perl 5.8 or higher, I'd really recommend my solution instead.
-- @/=map{[/./g]}qw/.h_nJ Xapou cets krht ele_ r_ra/; map{y/X_/\n /;print}map{pop@$_}@/for@/

Replies are listed 'Best First'.
Re^3: variation on splitting a string into elements of an array
by manav (Scribe) on Mar 02, 2005 at 17:18 UTC
    You are right on about the use of 'x'. btw, I didnt read the earlier comments as they were not there when I answered.

    Manav