$shorten_path = '/windows/command/shortn32'; $mp3_encoder = '/mp3/bladeenc/bladeenc'; opendir DIR, '.'; while (my $file = readdir(DIR)) { next unless $file =~ /\.shn$/i; ($file_out = $file) =~ s/\.shn$/.wav/i; `$shorten_path -x $file $file_out`; `$mp3_encoder -quit -quiet $file_out`; }