#!perl -w use strict; my $file = "graq.txt"; my $source = &get_path("oldfiles/$file"); my $result = &get_path("newfiles/$file"); open( READ, "<$source" ) or die( "Could not open $source: $!\n" ); open( WRITE, ">$result" ) or die( "Could not write to $result: $!\n" ); while() { # Do stuff. print WRITE $_; } close WRITE; close READ; # --------------------------------- # Local Functions. sub base_path { '/home/main/sub'; } sub get_path { return &base_path."/".$_[0]; }