ptkFAQ

 view release on metacpan or  search on metacpan

history/perl425.html  view on Meta::CPAN

<XMP>
     for (1..10) { print "Trial $_\n"; &foo('a', 'b', 'c') }
     sub foo { local(@_) = ('p', 'q', 'r'); }</XMP>This problem will be fixed in 5.003 - Bill
<XMP></XMP><P>

<HR><H2>Example 34 - Noted in c.l.p.misc by Maurice Cinquini </H2>
<P>I've even come across old perl4 programs which
unconsciously rely on the bugs in earlier perl versions.
<XMP>
    perl -e '$bar=q/not/; print "This is $foo{$bar} perl5"'</XMP><DL><DT><I>perl4 prints:</I><DD><XMP>This is not perl5</XMP></DL>
<DL><DT><I>perl4 prints:</I><DD><XMP>This is perl5</XMP></DL>
<XMP></XMP><P>

<HR><H2>Example 35 - Submitted by Markus F.X.J. Oberhumer and Danny Faught</H2>
<P>Stricter parsing of variables used in regular expressions
<XMP>
        s/^([^$grpc]*$grpc[$opt$plus$rep]?)//o;</XMP><DL><DT><I>perl4:</I><DD><XMP>compiles w/o error</XMP></DL>
<DL><DT><I>perl5:</I><DD><XMP>with Scalar found where operator expected ..., near "$opt$plus"</XMP></DL>
<XMP></XMP>an added component of this example, apparantly from the same script, is
the actual value of the <CODE>s'd</CODE> string after the substitution, e.g. - 
<XMP>

history/perl425.html-pl  view on Meta::CPAN


#############################################################################
# Example 34 - Noted in c.l.p.misc by Maurice Cinquini 
#############################################################################
I've even come across old perl4 programs which
unconsciously rely on the bugs in earlier perl versions.

    perl -e '$bar=q/not/; print "This is $foo{$bar} perl5"'

# perl4 prints: This is not perl5
# perl4 prints: This is perl5

#############################################################################
# Example 35 - Submitted by Markus F.X.J. Oberhumer and Danny Faught
#############################################################################
# Stricter parsing of variables used in regular expressions

        s/^([^$grpc]*$grpc[$opt$plus$rep]?)//o;

# perl4: compiles w/o error
# perl5: with Scalar found where operator expected ..., near "$opt$plus"



( run in 1.110 second using v1.01-cache-2.11-cpan-49f99fa48dc )