Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^4: Parse data from a line to get 2 variables

by Sunnmann (Acolyte)
on May 13, 2006 at 01:10 UTC ( #549152=note: print w/replies, xml ) Need Help??

in reply to Re^3: Parse data from a line to get 2 variables
in thread Parse data from a line to get 2 variables

First of all, I want to thank you all for your help. This is awesome!
You guys have come through for me every time I have asked for help and I
appreciate it! So thank you very much and I am tipping my hat to all of

And, yes it was for testing purposes, and at first I thought I may need
to parse it by the type of lot# it was. But that was for nought. The
main thing I do with Perl right now is change stuff I have to work in
new situations, I get stuck alot while trying to learn. My mentor here
at work left a while back and we dont use perl as much anymore so there
has been no need for this until now when I write simple scripts to do
some mundane stuff. I kind fo wish there was more need and i had the
time to really get down and learn it.

Anyways, enough of that, I did have another question. Could one of you
write out in words what the below line is saying? Or point me to a good
site that will tell me?


  • Comment on Re^4: Parse data from a line to get 2 variables

Replies are listed 'Best First'.
Re^5: Parse data from a line to get 2 variables
by Anonymous Monk on May 13, 2006 at 01:41 UTC

    \S+ matches one or more non-whitespace characters
    \s+ matches one or more whitespace chars


    my ($lot,$prod) = m/(\S+)\s+(\S+)/;

    is matching the lotnumber and putting it into $lot,
    matching the tab and throwing it away,
    then matching the product code and putting it into $prod

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2022-05-22 19:38 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (81 votes). Check out past polls.