Q: How to add this info $sv? Replace older by new one.
$ less stver.php
define('update_ver', 328);
$ less rec.pl
#!/usr/bin/perl
$sv="stver.php";
open (NUMECHO, "$sv") || die "Can't open $sv";
while (<NUMECHO>=~m/(\d+)/g) #digits output
{
chomp;
#print "$1\n";
$b=$1;
$a=$b;
++$a;
}
close (NUMECHO);
print "Old value = $b\n";
print "New value = $a\n";
When i run script
$ ./rec.pl
Old value = 328
New value = 329
All I need is to replace 328 by 329 into stver.php
this works as you excpect, adding 1 to stver.php’s number each time you execute it:
rec.pl: