Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Perl</h2> <ul> <li><p>Mixed use of sigils</p> <pre><code>my @array = ( 1, 2, 3 ); my $array = [ 4, 5, 6 ]; my $one = $array[0]; # not @array[0], you would get the length instead my $four = $array-&gt;[0]; # definitely not $array[0] my( $two, $three ) = @array[1,2]; my( $five, $six ) = @$array[1,2]; # coerce to array first my $length_a = @array; my $length_s = @$array; my $ref_a = \@array; my $ref_s = $array; </code></pre> <ul> <li><p>For example <strong>none</strong> of these are the same:</p> <pre><code>$array[0] # First element of @array @array[0] # Slice of only the First element of @array %array[0] # Syntax error $array-&gt;[0] # First element of an array referenced by $array @array-&gt;[0] # Deprecated first element of @array %array-&gt;[0] # Invalid reference $array{0} # Element of %array referenced by string '0' @array{0} # Slice of only one element of %array referenced by string '0' %array{0} # Syntax error $array-&gt;{0} # Element of a hash referenced by $array @array-&gt;{0} # Invalid reference %array-&gt;{0} # Deprecated Element of %array referenced by string '0' </code></pre></li> </ul> <p>In <code>Perl6</code> it is <a href="http://dev.perl.org/perl6/doc/design/syn/S09.html" rel="nofollow noreferrer">written</a>:</p> <pre><code>my @array = ( 1, 2, 3 ); my $array = [ 4, 5, 6 ]; my $one = @array[0]; my $four = $array[0]; # $array.[0] my( $two, $three ) = @array[1,2]; my( $five, $six ) = $array[1,2]; my $length_a = @array.length; my $length_s = $array.length; my $ref_a = @array; my $ref_s = $array; </code></pre></li> <li><p>Lack of true OO</p> <pre><code>package my_object; # fake constructor sub new{ bless {}, $_[0] } # fake properties/attributes sub var_a{ my $self = shift @_; $self-&gt;{'var_a'} = $_[0] if @_; $self-&gt;{'var_a'} } </code></pre> <p>In <code>Perl6</code> it is <a href="http://dev.perl.org/perl6/doc/design/syn/S12.html" rel="nofollow noreferrer">written</a>:</p> <pre><code>class Dog is Mammal { has $.name = "fido"; has $.tail is rw; has @.legs; has $!brain; method doit ($a, $b, $c) { ... } ... } </code></pre></li> <li><p>Poorly designed regex features</p> <pre><code>/(?=regexp)/; # look ahead /(?&lt;=fixed-regexp)/; # look behind /(?!regexp)/; # negative look ahead /(?&lt;!fixed-regexp)/; # negative look behind /(?&gt;regexp)/; # independent sub expression /(capture)/; # simple capture /(?:don't capture)/; # non-capturing group /(?&lt;name&gt;regexp)/; # named capture /[A-Z]/; # character class /[^A-Z]/; # inverted character class # '-' would have to be the first or last element in # the character class to include it in the match # without escaping it /(?(condition)yes-regexp)/; /(?(condition)yes-regexp|no-regexp)/; /\b\s*\b/; # almost matches Perl6's &lt;ws&gt; /(?{ print "hi\n" })/; # run perl code </code></pre> <p>In <code>Perl6</code> it is <a href="http://dev.perl.org/perl6/doc/design/syn/S05.html" rel="nofollow noreferrer">written</a>:</p> <pre><code>/ &lt;?before pattern&gt; /; # lookahead / &lt;?after pattern&gt; /; # lookbehind / regexp :: pattern /; # backtracking control / ( capture ) /; # simple capture / $&lt;name&gt;=[ regexp ] /; # named capture / [ don't capture ] /; # non-capturing group / &lt;[A..Z]&gt; /; # character class / &lt;-[A..Z]&gt; /; # inverted character class # you don't generally use '.' in a character class anyway / &lt;ws&gt; /; # Smart whitespace match / { say 'hi' } /; # run perl code </code></pre></li> <li><p>Lack of multiple dispatch</p> <pre><code>sub f( int $i ){ ... } # err sub f( float $i ){ ... } # err sub f($){ ... } # occasionally useful </code></pre> <p>In <code>Perl6</code> it is <a href="http://dev.perl.org/perl6/doc/design/syn/S06.html" rel="nofollow noreferrer">written</a>:</p> <pre><code>multi sub f( int $i ){ ... } multi sub f( num $i ){ ... } multi sub f( $i where $i == 0 ){ ... } multi sub f( $i ){ ... } # everything else </code></pre></li> <li><p>Poor Operator overloading</p> <pre><code>package my_object; use overload '+' =&gt; \&amp;add, ... ; </code></pre> <p>In <code>Perl6</code> it is <a href="http://dev.perl.org/perl6/doc/design/syn/S13.html" rel="nofollow noreferrer">written</a>:</p> <pre><code>multi sub infix:&lt;+&gt; (Us $us, Them $them) | (Them $them, Us $us) { ... } </code></pre></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload