Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: problems with arrays

by schumi (Hermit)
on Jun 20, 2002 at 09:52 UTC ( #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? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-01-18 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (53 votes). Check out past polls.

    Notices?