in reply to File modification

You don't need a 3-argument open when the open doesn't have any user input in it. And obfuscating the code doens't really help either, even if the result is shorter.
use strict; use warnings; my ($argact, $handle, $num); ($argact) = $ARGV[0] =~ /(\d+)/; exit if !$argact; open $handle, 'one.txt'; $_ = join '', <$handle>; close $handle; ($num) = m/(\d+)$/; if ($num != $argact) { s/(\d+)$/$argact/; open $handle, '>one.txt'; print $handle $_; close $handle; }