my $debug = shift @ARGV; print "debug mode\n" if $debug; # where is INFILE opened? while () { # assuming you want what is between the '' after version chomp($old_version) && last if ($old_version) = /ver = '(.*?)'/; } close INFILE; # assuming .pro is end of projectPath my ($projlabl) = $projectPath =~ /(.*)\.pro$/; $projlabl .= 'labeler';