#!/usr/bin/env perl use strict; use warnings; use autodie; use HTML::Escape 'escape_html'; my %commands = (ls => '/usr/bin/ls -al'); my @targets = qw{a_real_dir not_a_real_dir}; my $program = 'ls'; print "\n
...\n\n"; for my $target (@targets) { my $cmd = "$commands{$program} $target 2>&1"; print '\n";
{
open my $cmd_pipe, '-|', $cmd;
print escape_html($_) while <$cmd_pipe>;
}
print "\n";
}
print "\n\n";