in reply to Looping through a split() and more...

Is this what you want???
foreach(@sessions){ my @lines=split "\n",$_; foreach(@lines){ my ($port,$user,$host,$type,$dir,$status,$start,$idle)=split /\s+/ +,$_; # do stuff on each line here, probably want to ignore the header l +ines } }

Replies are listed 'Best First'.
RE: Re: Looping through a split() and more...
by cwest (Friar) on Jun 01, 2000 at 00:56 UTC
    Don't do that with split(), (please)

    split() works as follows ( I know it may work the way you have it but.. well... that's just wrong:

    split /:/, $passwd_line;
    split '', $line; # 'Special' case
    
    Thanks,
    --
    Casey
    
      To what, in particular, are you refering?
        I'm refering to splitting on a scalar value such as the following wrong way:
        split "\n", $line;
        
        --
        Casey