in reply to Masters of Loops and Filehandles
Here's a quickie example that should get you on your way:
#!/usr/bin/perl my $Gibberish=<<EOGibberish; This is a sentence. It's not a particularly great sentence, but it's a sentence nonetheless. It would suck if someone accidentally changed it! EOGibberish use strict; use warnings; use autodie; my $search; open my $FH, '<', $0; binmode $FH; seek $FH, 55, 0; read $FH, $search, 8; close $FH; $Gibberish =~ s/$search/XXXXXXXX/g; print $Gibberish;
When I run it here, I get:
marco@Boink:~ $ perl splorch.pl This is a XXXXXXXX. It's not a particularly great XXXXXXXX, but it's a XXXXXXXX nonetheless. It would suck if someone accidentally changed it!
...roboticus
When your only tool is a hammer, all problems look like your thumb.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Masters of Loops and Filehandles
by pbyfire (Novice) on May 10, 2012 at 14:40 UTC | |
by roboticus (Chancellor) on May 10, 2012 at 22:35 UTC |