#!/usr/bin/perl -w @files = <*/file>; for ($pos = 0; $pos<=1000; $pos++) { foreach $file (@files) { $char = substr($file, 0, index($file, "/")); open(FILE, $file); while () { $line = $_; chop($line); chop($line); if ($line eq $pos) { if ($char eq "space") { $char = " "; } if ($char eq "quote") { $char = "'"; } if ($char eq "coma") { $char = ","; } if ($char eq "dot") { $char = "."; } print $char; } } close(FILE); } } print "\n";