Changeset 12933 for docs/Perl6/Perl5

Show
Ignore:
Timestamp:
09/02/06 00:11:33 (2 years ago)
Author:
markstos
Message:

refine Regexes and Rules section in Differences.pod

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • docs/Perl6/Perl5/Differences.pod

    r12923 r12933  
    185185=head1 Regexes and Rules  
    186186 
    187 Many many changes.  Just read S05.  But if you're in a panic and need 
    188 to get something working now, you just need to know that you can use 
    189 Perl 5-compatible regexes with the C<:P5> modifier.  And that 
    190 modifiers come before, not after, regexes in Perl 6.  Oh, and that 
    191 C<=~> has changed to C<~~>.... 
    192  
    193     Was:    $str =~ /^\d{2,5}\s/ 
    194     Now:    $str ~~ m:P5/^\d{2,5}\s/ 
     187Here's a simple translation of a Perl5 regular expression to Perl6: 
     188 
     189    Was:    $str =~ m/^\d{2,5}\s/i 
     190    Now:    $str ~~ m:P5:i/^\d{2,5}\s/ 
     191 
     192The 'P5' modifier is there because the standard Perl6 syntax is rather 
     193different, and 'P5' notes a Perl5 compatibility syntax.  For the full 
     194specification, see L<S05>. See also: 
     195 
     196The related Apocalypse, which justifies the changes: 
     197 
     198  http://dev.perl.org/perl6/doc/design/apo/A05.html  
     199 
     200And the related Exegesis, wihch explains it more detail: 
     201 
     202  http://dev.perl.org/perl6/doc/design/exe/E05.html 
    195203 
    196204=cut