http://qs321.pair.com?node_id=175945


in reply to problems with arrays

Hi.

From your code I assume that your columns have more than one space between them, as you say split (/\s+/, $line) - how sure are you of that?

Anyway, I'd do something along the lines of this:

# remove a single whitespace from the start of lines foreach $line (@array) { $line =~ s/^\s//g; }

The ^ matches the beginning of a string or line - else you'd strip out occurences of whitespace where you'll need them for your split. This should do the trick, I think.

Update: Right after having hit stumbit, I realised that wil was quicker than me - wil++.

--cs

There are nights when the wolves are silent and only the moon howls. - George Carlin