Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Another Q about piping Perl

by tommyw (Hermit)
on Oct 12, 2001 at 03:20 UTC ( #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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-05-24 18:41 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (84 votes). Check out past polls.