Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by poolpi (Hermit)
on Jul 22, 2008 at 21:22 UTC ( [id://699431]=note: print w/replies, xml ) Need Help??


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

Just for fun ;)

#!/usr/bin/perl -w use strict; use autodie qw(open close); { undef $/; my %file = ($1 => split /<\s*(.+)\n/ , <DATA>); map { $_ and open my $fh, q{>}, $_; select $fh; print $file{$_} and close; } keys %file; } __DATA__ < file1.txt line1 of file1 line2 of file1 line3 of file1 line4 of file1 < file2.txt line1 of file2 line2 of file2 line3 of file2 < file3.txt line1 of file3 line2 of file3 line3 of file3 line4 of file3

hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2025-06-17 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.