http://qs321.pair.com?node_id=964480

preahkumpii has asked for the wisdom of the Perl Monks concerning the following question:

I have a file, each line needs to be put into another file and the filename taken from the first few chars of each line in the source file. Here is what I have so far:
#!/usr/bin/perl # chess.plx use warnings; use strict; use utf8; open THAI, "thaikjv-fixed.txt" or die $!; binmode(THAI, ":utf8"); foreach(<>) { if (/^@(...\d\d\d)/) { my $r = "$1.html"; open O, ">$r" or die $!; binmode(O, ":utf8"); print O "$_"; print "hi"; close (O); } }
Thanks for any help.