Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: Re: Re: perlcheat

by TheDamian (Priest)
on Feb 24, 2003 at 05:41 UTC ( #238033=note: print w/replies, xml ) Need Help??

in reply to Re: Re: perlcheat
in thread perlcheat

Perl 6 is a new language.

Err. No. Perl 6 is a new version of the same language: Perl. Just as Perl 5 was. Just as Perl 4 was.

Most of this cheat sheet does not apply to Perl 6.

Au contraire! The vast majority of it is unchanged for Perl 6. See my other node on this topic.

Heck, most of Perl as we know it does not apply to Perl 6.

Just not true. My guess is that about 80% of your existing Perl knowledge will map usefully over to Perl 6.

I think the difference between Perl 5 and 6 will much greater than the difference between C and C++ :)

I very much doubt it. More like the difference between pre-ANSI C++ and post-ANSI C++.

Except, of course, that Perl 6 won't suck. ;-)

Replies are listed 'Best First'.
Re: Re: Re: Re: perlcheat
by Juerd (Abbot) on Feb 24, 2003 at 06:51 UTC

    Err. No. Perl 6 is a new version of the same language: Perl. Just as Perl 5 was. Just as Perl 4 was.

    I know that's the story. My brain just won't accept it as a fact. Doesn't re-designing something from scratch essentially make it new? Anyhow, please excuse me for spreading wrong information.

    Au contraire! The vast majority of it is unchanged for Perl 6.

    Array and hash slice and element sigils change, the arrow becomes a nice little dot, parens in constructs like loops are no longer needed for most expressions, the operator precedence table is likely to change, regex metacharacters change as well as regex modifier and predefined classes (or should I say rules?). Many of the special variables change or are reincarnated as att^H^H^Hproperties. That leaves only context (the current list is incomplete too: Perl 5 already has several scalar contexts), sigils (but will there still be globs?), do's and don't's. I wouldn't call that "the vast majority".

    Except, of course, that Perl 6 won't suck. ;-)

    Of course it won't suck :) And sure, it will still be Perl, a better Perl even. Just not the Perl I know.

    - (do not use).

      I wouldn't call that "the vast majority".

      The bits that are the same:

      void $scalar @array %hash scalar @array @array[0, 2] list %hash &sub number, string, reference, undef \ references $@%& dereference [] anon. arrayref {} anon. hashref \() list of refs = = + ++ -- == != eq ne ** < > <= >= lt gt le ge ! \ u+ u- <=> cmp !~ * / % x + - . for (LIST) { }, while ( ) { }, until ( ) { } named uops if ( ) { } elsif ( ) { } else { } < > <= >= lt gt le ge unless ( ) { } elsif ( ) { } else { } == != <=> eq ne cmp && ^ string begin || .. + one or more * zero or more = += -= *= etc. ? zero or one , list ops () capture not and \s == [\x20\f\t\r\n] or xor | alternation \w == [A-Za-z0-9_] \b word boundary \d == [0-9] \S, \W and \D negate use strict; use warnings; "$foo" my $var; $$variable_name open() or die $!; `$userinput` use Modules; /$userinput/ stat localtime caller 0 dev 0 second 0 package $_ default variable 1 ino 1 minute 1 filename 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 wantarray 6 rdev 6 weekday 6 evaltext 7 size 7 yearday 7 is_require 8 atime 8 is_dst 8 hints 9 mtime 9 bitmask @ARGV command line args 10 ctime just use @INC include paths 11 blksz POSIX:: 3..9 only @_ subroutine args 12 blcks strftime! with EXPR %ENV environment

      The bits that differ:

      @hash{'a', 'b'} $array[0] $hash{'a'} *glob glob $$foo[1] aka $foo->[1] * dereference $$foo{bar} aka $foo->{bar} ${$$foo[1]}[2] aka $foo->[1]->[2] ${$$foo[1]}[2] aka $foo->[1][2] -> . ~ =~ << >> for equals foreach (ALWAYS) & | ^ /i case insens. $ str. end (before \n) /m line based ^$ ... /s . includes \n ?: /x ign. /g global => {3,7} repeat in range (?:) no capture . == [^\n] [] character clas \z string end $0 program name $/ input separator $\ output separator $| autoflush $! sys/libcall error $@ eval error $$ process ID $. line number

      So 153 of the 194 Perl features listed in the cheatsheet (congratulations on packing that much in, by the way!) are the same for Perl 6. That's 79% unchanged. I would call that a "vast majority".

      And, yes, I'm counting the for, if, while, etc. syntaxes as being the same. Sure, the parens are optional but that just means you can go on using them exactly as you do now (i.e. no change required).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://238033]
[erix]: I recognise the makings of a fine argument
[LanX]: lanx wonders ... how likely is it to talk >95% BS without intention?
[erix]: "gigantic amounts of data" is also not SQLite (imho)
talexb wonders why sqlite2 was deprecated in favour of sqlite3.
[erix]: looks like a fork, rather, no?
LanX /me /me
[erix]: /hehehe
[marto]: LanX yesterday I found out about Gish gallop tactic

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2017-07-28 15:38 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (431 votes). Check out past polls.