Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: splitting file with mutiple output filenames

by snape (Pilgrim)
on Apr 11, 2012 at 10:05 UTC ( [id://964494]=note: print w/replies, xml ) Need Help??


in reply to splitting file with mutiple output filenames

This should work for you

#!/usr/bin/perl use warnings; use strict; use utf8; my $filename = "thaikjv-fixed.txt"; open my $THAI, $filename or die $!\n"; binmode ($THAI, ":utf8"); while (<$THAI>) { chomp $_; if ($_ =~ m/^@(...\d\d\d)/){ my $r = "$1.html"; open my $OUT, '>', $r or die $!\n"; binmode ($OUT, ":utf8"); print $OUT $line; close($OUT); } } close($THAI);

Log In?
Username:
Password:

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

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

    No recent polls found