Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: problems with arrays

by schumi (Hermit)
on Jun 20, 2002 at 09:52 UTC ( [id://175945]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://175945]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 02:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found