in reply to increment id num
Perl script:"I000001","dummy","dummy" "I000003","dummy","dummy" "I000002","dummy","dummy" "I000004","dummy","dummy" "I000010","dummy","dummy" "I000019","dummy","tommy"
Besides, Limbic~Region's proposal to use the magic of the increment operator is interesting too, trymy $content; open FILE, '+<', 'file.dat' or die "Could not open 'file.dat': $!\n"; $content = $_ for (<FILE>); $content =~ s/(?<=^"\w)(\d{6})/sprintf "%06d", $1 + 1/e; print FILE "\n$content"; close FILE;
to get acquainted with it.perl -e "$x = 'I000199'; print ++$x"
|
|---|