use constant DEFAULT_FILE => "/etc/filesystems"; my $file = shift || DEFAULT_FILE; # e.g. to take file from command line or use the default find_pattern($file, $pattern); sub find_pattern { my ($file, $pattern) = @_; # your code here }