#!/usr/bin/perl use warnings; use strict; my $path = shift; my $output = `dir $path`; $output =~ s/DIR/FOO/g; print $output;