From: Robin Norwood <[EMAIL PROTECTED]>
> "Jamie Risk" <[EMAIL PROTECTED]> writes:
> 
> > It's been my experience that readers of this group relish a
> > demonstration of their persnicketiness.  For this I give the
> > following; it works, but doesn't appeal to me:
> > 
> >    my @tmp_list;
> >    my @list;
> >    my $description;
> >    push @tmp_list, split(/\t/,$_,6);
> >    push @list, $tmp_list[0],
> > $tmp_list[1],$tmp_list[2],$tmp_list[3],$tmp_list[5];
> >    $description = $tmp_list[4];
> > 
> > There are six sub-strings separated by tab stops.  Sub-strings zero
> > through three and five are extracted to a list.  Sub-string four is
> > extracted to its own variable.
> > 
> > Suggestions?
> 
> Well, a slice instead of pushing individual elements helps a little
> bit:
> 
> @list = (@tmp_list[0 .. 3], $tmp_list[5]);

And if there is anything in the @list already:

        push @list, @tmp_list[0 .. 3], $tmp_list[5];

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to