print "debug mode\n" if shift; read INFILE, my $infile, -s '/path/to/infile'; #<- not specified in OP close(INFILE); my ($old_version) = $infile =~ /^.*?ver = '(.*?)'/; (my $projlabl = $projectPath) =~ s/\.pro/labeler/;