diff options
author | Brian Gottreu <gottreu@gmail.com> | 2013-06-16 13:37:33 -0500 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-22 22:11:44 -0700 |
commit | 555bd962bf06d749086724e280b3588586df7805 (patch) | |
tree | 50a45eca58f93ccc0fe9ddb4e9167d302f6b6415 /pod/perlrequick.pod | |
parent | 6ca3c6c679258bbb20a4445b34608d144ac7090d (diff) | |
download | perl-555bd962bf06d749086724e280b3588586df7805.tar.gz |
Fixed verbatim lines in POD over 79 characters
Diffstat (limited to 'pod/perlrequick.pod')
-rw-r--r-- | pod/perlrequick.pod | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pod/perlrequick.pod b/pod/perlrequick.pod index bd44d013c5..008ef339fe 100644 --- a/pod/perlrequick.pod +++ b/pod/perlrequick.pod @@ -85,8 +85,9 @@ for a carriage return. Arbitrary bytes are represented by octal escape sequences, e.g., C<\033>, or hexadecimal escape sequences, e.g., C<\x1B>: - "1000\t2000" =~ m(0\t2) # matches - "cat" =~ /\143\x61\x74/ # matches in ASCII, but a weird way to spell cat + "1000\t2000" =~ m(0\t2) # matches + "cat" =~ /\143\x61\x74/ # matches in ASCII, but + # a weird way to spell cat Regexes are treated mostly as double-quoted strings, so variable substitution works: @@ -353,7 +354,7 @@ Here are some examples: /(\w+)\s+\g1/; # match doubled words of arbitrary length $year =~ /^\d{2,4}$/; # make sure year is at least 2 but not more # than 4 digits - $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3 digit dates + $year =~ /^\d{4}$|^\d{2}$/; # better match; throw out 3 digit dates These quantifiers will try to match as much of the string as possible, while still allowing the regex to match. So we have @@ -437,7 +438,8 @@ substitute was bound to with C<=~>): print "$x $y\n"; # prints "I like dogs. I like cats." $x = "Cats are great."; - print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~ s/Frogs/Hedgehogs/r, "\n"; + print $x =~ s/Cats/Dogs/r =~ s/Dogs/Frogs/r =~ + s/Frogs/Hedgehogs/r, "\n"; # prints "Hedgehogs are great." @foo = map { s/[a-z]/X/r } qw(a b c 1 2 3); |