S
Sara
To substitute over multiple lines, one would need something like
s/CAT/DOG/msg;
But to SPLIT those same lines the "ms" is apparently "implied":
my @all_matches = split /CAT/, $_;
my @all_matches = split /CAT/ms, $_;
will both split the entire paragraph, not just line 1. Why? Why would
one assume that programmers would need to substitute only line 1, but
wold always need to split the whole paragraph. Doesn't make sense, and
appears to be inconsistent. The only rationale I see roughly alluded
to in Camel is that split is the "opposite of" join, so since join
obviously works over multiple array elements, to be a true inverse
then split would need to work over the entire scalar?
Also, along these same lines why isn't $_ taken as the default arg for
split, such that:
split /CAT/, $_;
would be identical to
split /CAT/; # throws an error
?
This cat is curious.
s/CAT/DOG/msg;
But to SPLIT those same lines the "ms" is apparently "implied":
my @all_matches = split /CAT/, $_;
my @all_matches = split /CAT/ms, $_;
will both split the entire paragraph, not just line 1. Why? Why would
one assume that programmers would need to substitute only line 1, but
wold always need to split the whole paragraph. Doesn't make sense, and
appears to be inconsistent. The only rationale I see roughly alluded
to in Camel is that split is the "opposite of" join, so since join
obviously works over multiple array elements, to be a true inverse
then split would need to work over the entire scalar?
Also, along these same lines why isn't $_ taken as the default arg for
split, such that:
split /CAT/, $_;
would be identical to
split /CAT/; # throws an error
?
This cat is curious.