Sure,this code is more brief:

$hash{$i++}=[split] while (<>);

thank u.


On Thu, 08 Sep 2005 19:54:11 -0700, "John W. Krahn" <[EMAIL PROTECTED]>
said:
> Jeff Pan wrote:
> > #/usr/bin/perl
> 
> use warnings;
> use strict;
> 
> > my $i=0;
> > my %hash;
> > 
> > while (<>)
> > {
> >     chomp;
> >     s/^\s+|\s+$//g;
> >     $hash{$i}=[split];
> >     $i++;
> 
> You could write those four lines as:
> 
>     $hash{$i++}=[split];
> 
> 
> > }
> > 
> > print $hash{0}->[0],"\n";
> > print $hash{1}->[2],"\n";
> > 
> > Is this useful?
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
-- 
  Jeff Pan
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - Send your email first class


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to