Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Remove the first word for each lines from a text file

by ExReg (Priest)
on Dec 22, 2016 at 21:05 UTC ( [id://1178389]=note: print w/replies, xml ) Need Help??


in reply to Remove the first word for each lines from a text file

Expanding on what Corion said, you second while loop is what is causing the problem. Instead of

print $out $_ while s/^\s*\S+\s*//;

get rid of the inner while:

s/^\s*\S+\s*//; print $out;

Replies are listed 'Best First'.
Re^2: Remove the first word for each lines from a text file
by Anonymous Monk on Dec 22, 2016 at 21:41 UTC
    s/^\s*\S+\s*//; print $out;

    Not quite, that prints the value of $out ("GLOB(0xabc...)") to the currently selected filehandle; the print $out $_; is necessary in this case.

      You are right. I blame it on my computer. It is out to get me toda

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-03-28 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found