Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Here's a first draft of the equivalent Perl 6 cheatsheet. I have deliberately restricted it to the same topics. Notice how similar to the Perl 5 version most of it is?
Perl 6 cheat sheet v1 Based on the Perl 5 cheetsheet by Juerd Waalboer . CONTEXTS SIGILS ARRAYS HASHES void $scalar whole: @array %hash scalar @array slice: @array[0, 2] %hash{'a', 'b'} list %hash element: @array[0] %hash{'a'} &sub SCALAR VALUES number, string, reference, undef REFERENCES \ references @{$foo}[1] aka $foo.[1] $@%& dereference %{$foo}{bar} aka $foo.{bar} [] anon. arrayref @{@{$foo}[1]}[2] aka $foo.[1].[2] {} anon. hashref @{@{$foo}[1]}[2] aka $foo[1][2] \() list of refs NUMBERS vs STRINGS LINKS OPERATOR PRECEDENCE = = perl.plover.com + ~ search.cpan.org ++ -- == != eq ne cpan.org ** < > <= >= lt gt le ge pm.org ! u^ \ u+ u- ? u~ <=> cmp tpj.com ~~ !~ perldoc.com * / % x xx SYNTAX + - ~ for LIST { }, loop (a;b;c) { } .<< .>> +<< ~<< etc. while EXPR { }, until ( ) { } named uops if EXPR { } elsif EXPR { } else { } & unless EXPR { } elsif EXPR { } else { } |^ < > <= >= lt gt le ge == != <=> eq ne cmp && REGEX METACHARS REGEX MODIFIERS || ^^ // ^ string begin :i case insens. $ string end :w skip w/space .. + one or more :e each ?? :: * zero or more = += -= *= etc. ? zero or one , () capture list ops [] no capture REGEX CHARCLASSES not <[]> character class . == any char and | alternation \s == [\x20\f\t\r\n] or xor err <1,2> repeat in range \w == [A-Za-z0-9_] \b word boundary \d == [0-9] \S, \W and \D negate DO use strict; DON'T LINKS use warnings; "$foo" perl.com my $var; $$variable_name perlmonks.org open() err die $!; `$userinput` use.perl.org use Modules; /$userinput/ perl.apache.org parrotcode.org FUNCTION RETURN OBJECT ELEMENTS stat localtime caller SPECIAL VARIABLES 0 dev 0 second 0 package $_ current topic 1 ino 1 minute 1 filename $0 regex result 2 mode 2 hour 2 line 3 nlink 3 day 3 subroutine 4 uid 4 month-1 4 hasargs 5 gid 5 year-1900 5 want $! error object 6 rdev 6 weekday 6 evaltext 7 size 7 yearday 7 is_require 8 atime 8 is_dst 8 hints 9 mtime 9 bitmask @ARGS command line args 10 ctime @INC include paths 11 blksz @_ subroutine args 12 blcks %ENV environment

In reply to Perl 6 version of cheatsheet by TheDamian
in thread perlcheat by Juerd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found