First you need to read in each line content from the file. An explanation to read & write file in perl can be found here. Then extract the number portion you need (the last 3 number groups in a line) using match functionality (something similar to $string =~ m/regex(capture_group)regex/). Take the matched string and manipulate it the way you want (remove the leading '3'). Then either append to a file or keep it in an array variable. If the array size is 1000, write to file and clear the array. Keep doing until no more to read, write the rest of whatever in the array to file and done.
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17
@2teez, nice explanation :)
After I think about using match, I think there is no reason to match if a sub string is already found. Why not using sub instead...
# rather do this
$number = substr( $number, 1 ) if $number =~ m/^3/;
# how about...
$number =~ s/^3//;
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17