- or download this
while($some_data=~ m/some_regex/)
{
# Do some stuff
}
- or download this
while($some_data=~ m/some_regex/g)
{
# Do some stuff
}
- or download this
$to_replace='some_string';
$my_string=~ s/$to_replace/$better_data/;
- or download this
$to_replace='a caret looks like ^';
$my_string=~ s/$to_replace/$better_data/;
- or download this
$to_replace='a caret looks like ^';
$my_string=~ s/\Q$to_replace\E/$better_data/;
- or download this
$to_replace=qr/^your_regex_here$/;
$my_string=~ s/$to_replace/$better_data/;
- or download this
while($string=~ m/(reg)(ex)/g)
{
$string=~ s/$1$2/$1ister/;
}
- or download this
$string=~ s/(reg)ex/$1ister/g;
- or download this
$dummy=$string;
while($dummy=~ m/(reg)(ex)/g)
{
$string=~ s/$1$2/$1ister/;
}
- or download this
while($string=~ m/(reg)(ex)/)
{
$string=~ s/$1$2/$1ister/;
}
- or download this
for($i=0;$i<@array;$i++)
{
...
delete $array[$i];
}
}
- or download this
for($i=0;$i<@array;$i++)
{
...
splice @array,$i,1;
}
}
- or download this
for($i=0;$i<@array;$i++)
{
...
$i--;
}
}
- or download this
@array = @array[grep {!should_delete($_)} 0..$#array];
- or download this
$rec_sep=$/;
undef $/;
$slurp=<INPUTFILE>;
# Regex matching here ...
- or download this
$rec_sep=$/;
undef $/;
$slurp=<INPUTFILE>;
print "Enter something: ";
$something=<STDIN>;
- or download this
$rec_sep=$/;
undef $/;
...
$/=$rec_sep;
print "Enter something: ";
$something=<STDIN>;
- or download this
my $data = do {local $/; <INPUTFILE>};
- or download this
open COMMAND,'-|','some_command';
$input=<COMMAND>;
...
#....bla bla
wait if $pid
#... bla bla
- or download this
open COMMAND,'-|','some_command';
$input=<COMMAND>;
...
#....bla bla
wait if $pid
#... bla bla
- or download this
open COMMAND,'-|','some_command';
$input=<COMMAND>;
...
#....bla bla
waitpid $pid,0;
#... bla bla
- or download this
undef $_ for keys %SIG;
fork while 1;