#!/usr/bin/perl -w ############################# use strict; use warnings; use Tie::File; my @ry=(); # This will be tied my $OLDIFS=$/; # save the IFS $/="\$\n"; # now change it to suit our needs # # Rope tie and brand 'em! YEEE-HAW! tie @ry,"Tie::File","datFile.txt" or die $!; foreach my $rec(@ry){ #iterate through the records chomp $rec; # Eliminate IFS next unless $rec; # Eliminate spew about blank records # if they happen my $fname=(split(/\n/,$rec))[0]; # Get the name next unless $fname; # ho hum. Sometimes you're the # windshield, sometimes you're # the bug. open FOUT,"> $fname" or die "$fname:$!"; # Open file print FOUT $rec; #store record close FOUT; # done with this } untie @ry; # cut them thar ropes!