in reply to Spliting file + removing column

Just a quick side note. This

@row = $row; (@row[0],@row[1],@row[2], @row[3], @row[4], @row[5], @row[6])=split(/\ +s+/,$row);

is more compactly written as

my @row = split(/\s+/,$row);

(Strictly speaking, the latter would create more than 7 array elements, in case there are more fields in the input — but you only seem to have 6 anyway.  The direct equivalent would be @row = (split /\s+/,$row)[0..6];)

Also, @row[3] (i.e. an array slice with a single element) is generally better written as $row[3].

Replies are listed 'Best First'.
Re^2: Spliting file + removing column
by jwkrahn (Abbot) on Jan 13, 2011 at 11:15 UTC
    my @row = split(/\s+/,$row);

    is more compactly written as

    my @row = split' ',$row;

      ...it's not the same. In other words, it depends on what the OP wants.

      split ' ' is "magic" in that it ignores leading white space, while split /\s+/ does not.