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

Re: Another Q about piping Perl

by tommyw (Hermit)
on Oct 12, 2001 at 03:20 UTC ( [id://118366]=note: print w/replies, xml ) Need Help??


in reply to Another Q about piping Perl

Well, the error message about being unable to modify <HANDLE> might be considered a bit of a clue: grab the input, and modify it separately:

echo $HOME/Mail/* | perl -e 'while (<STDIN>) { s/sent-mail//; print "$ +_"}'

Or just use the -p option, and really make it look like your sed command:

echo $HOME/Mail/* | perl -p -e '/sent-mail//'

update:Whoops. Of course, the missing s before the substitution string was meant as an exercise for the reader ;) echo $HOME/Mail/* | perl -p -e 's/sent-mail//'

But personally, I'd stick with sed, if I've got the choice: it's less memory hungry for such simple tasks

Replies are listed 'Best First'.

Log In?
Username:
Password:

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

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

    No recent polls found