Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How to generate files based on some special character?

by AltBlue (Chaplain)
on Jul 22, 2008 at 19:47 UTC ( [id://699408]=note: print w/replies, xml ) Need Help??


in reply to How to generate files based on some special character?

If you are very lazy, you could run this:
$ perl -lane '$F[0] eq "<" and open O, "> $F[1]" or print O $_' large_ +file

Obviously, I wouldn't use this at home, as it could burn it down ;-)

...because there are no error checks (on "file name", open and print) and because of the sloppy 2-arguments usage of open

--
altblue.

Replies are listed 'Best First'.
Re^2: How to generate files based on some special character?
by AltBlue (Chaplain) on Jul 22, 2008 at 20:00 UTC
    Or be even more reckless and drop a few more keys ;-)
    $ perl -ne '/^< (.+)/ and open STDOUT, "> $1" or print' large_file
    God help you if you ever try to use such dumb code against some wild input ;-)

    --
    altblue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-06-24 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.