The OLDNAME you are looking for is contained in the $_ variable, which holds the current filename. Note that this variable (also called $ARG — see perlvar#General-Variables) is special: it is “understood” (used implicitly) in many Perl constructs. For example, /abc/ by itself is shorthand for $_ =~ /abc/.