#!/usr/bin/perl -wT use strict; ## check your arguments @_ == 2 or die "Usage: $0 from to\n"; ## specify your command my $cmd = '/usr/bin/mv'; ## untaint your input my( $from ) = ( $ARGV[0] =~ s/(\w|[/\\])+/$1/ ); my( $to ) = ( $ARGV[1] =~ s/(\w|[/\\])+/$1/ ); ## make sure the input is good ( defined $from and defined $to ) or die "ERROR: $0 - bad input\n"; ## run the command without using the shell ## check return code for errors system( $cmd, $from, $to ) or die "ERROR: $0 - can't $cmd! $!";