Example:
use strict;
my $file = shift;
open(IN, $file) || die \"Unable to open $file\\n\";
open(OUT, \">$file.$$\") or die $!;
What is goin
shift uses the @_ variable which contains the values passed to a function or shift uses @ARGV for the values passed to the script itself if shift is referenced outside of a function.
ONE WORD OF CAUTION: It is probably wise, especially in Windows where many paths contain spaces, to put the filename and path in single quotes when you pass it to the script or function. This will tell Perl that you are passing it a single scalar value rather than an array of values. You can use double quotes if you want to interpolate part of the name. For example:
my $path = 'C:\Goat Kids';
func("$path\\goat.txt");
Or, from the command line if you are passing the filename directly to the script:
perl goat.pl "C:\Goat Kids\goat.txt"