- or download this
perl -i.bak -lpe 's/PERL/perl/g' file
- or download this
{
local ($^I, @ARGV) = ('.bak', 'file');
...
print;
}
}
- or download this
tie @lines, 'Tie::File', 'file' or die ...;
for (@lines) {
s/PERL/perl/g;
}
untie @lines;
- or download this
for (@lines) {
if (/<!-- insert here -->/) {
...
last;
}
}
- or download this
unshift @lines, $new; # Or add more than one record
- or download this
open DB, "< $database" or die ...;
...
my $user = shift;
return $db{$username};
}
- or download this
tie @DB, 'Tie::File', $database or die ...;
for (@DB) {
...
my $username = shift;
return $DB[$recno{$username}];
}
- or download this
sub replace_data {
my ($username, $new_data) = @_;
...
$data[1] = $crypted_password;
replace_data($username, join(':', @data));
}