#! /usr/bin/perl -w my $infil = $0; my $separator = "XXFFDDF"; local $/ = $separator; sysopen(INFIL,$infil,O_RDONLY) || die "Can't open $infil: $!.\n"; while(){ my $out_file = "$infil.$."; # s/$separator//; ### if you want to remove your file separator also, uncomment above line ..... sysopen(OUT,$file,O_RDWR|O_CREAT|O_EXCL) || die "Can't open for write tst.$.: $!.\n"; print OUT $_; } close(INFIL);