in reply to Search and replace text
This reeks of being a homework assignment, so my assistance will be limited to two items:
1: To generate a 2 digit random number, you could use something like:
You'll need the number, so hang onto it.$x = int(rand(100));
2: Read the Perl documentation. You could do something like this:
where $x is your random value and $y the line you're changing.$y =~ s!^\d{2}!$x!;
The actual i/o and program logic will be left as an exercise.
emc
" When in doubt, use brute force." — Ken Thompson
|
|---|