#!/usr/bin/perl use strict; use warnings; my $outdir = 'D:/share/out'; my $inpath = "D:/share/in/content.txt"; open my $inFile, '<', $inpath or die "Failed to open $inpath: $!"; while (<$inFile>) { chomp; my ($title, $content) = split "\t", $_, 2; my $outpath = "$outdir/$title$."; open my $outFile, '>', $outpath or die "Can't create $outpath: $!"; print $outFile $content; close $outFile; } close $inFile;