http://www.perlmonks.org?node_id=144107


in reply to Will my code work in Perl 6?

Perl 5
while <STDIN> { ...

In Perl 5, the parens are not optional. And please use a monospaced font for code :).

dot/underscore
String Concatenation from . to _. Note: whitespace is neccessary.

Only if there's a \w character next to it. $foo{bar}_$foo{bar} will be possible, but $foo_$bar will not (or at least not DWIM).

'for' is now a shortcut for 'foreach'.

I don't know if shortcut is the right word, but currently, for and foreach are exactly the same. That is, foreach (EXPR;EXPR;EXPR) and for (LIST) work.

2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

Replies are listed 'Best First'.
Re: Re: Will my code work in Perl 6?
by $code or die (Deacon) on Feb 08, 2002 at 19:39 UTC

    Hi, thanks for the corrections.

    And please use a monospaced font for code :)

    I thought I was! It looks ok on my screen. But my fonts were a little messed up by Opera. I checked it a few days ago in IE and it looked ok too.

    I was confused about the for/foreach bit. Apocalypse 4 says: 'And for will now always mean "foreach"'. Now I'm more confused. perlsyn says: '"foreach" keyword is actually a synonym for the "for" keyword'. I suppose it means that neither for, nor foreach will have the C-style (;;) construct.

    Thanks for the help.

    ___ Simon Flack ($code or die)
    $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
    =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
      It seems Konqueror renders <pre> in whatever font the underlying element has. I don't know if that's how CSS was supposed to work, but you could of course add PRE { font-family: courier; } to your style sheet.

      2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

        Right. the <tt> is usually rendered as monospaced font. But it is useragent-dependent. Stylesheets are preferred.

        Thanks again --Simon

        ___ Simon Flack ($code or die)
        $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
        =~y'_"' ';eval"die";print $_,lc substr$@,0,3;