Re: perl bug with references
- From: Ben Morrow <ben@xxxxxxxxxxxx>
- Date: Wed, 28 Feb 2007 04:29:02 +0000
Quoth "dt" <ppc@xxxxxxxxxxxxxx>:
I found an odd behavior.
when I have a reference, let's say it is an array, it seems to pad the
value differently in perl 5.6 vs 5.8:
this worked in perl 5.8 but not perl 5.6:
$ref =~ /^ARRAY/;
for 5.6, I had to change to =~ /^\s*ARRAY/;
could not find anything mentioning this behavior anywhere. I doubt it
is a "feature"
Works for me:
~% perl -v
This is perl, v5.8.8 built for i686-linux
....
~% perl -le'print [] =~ /^ARRAY/ ? "match" : "no match"'
match
~%
You shouldn't be doing this anyway. Use Scalar::Util::reftype.
Ben
--
All persons, living or dead, are entirely coincidental.
ben@xxxxxxxxxxxx Kurt Vonnegut
.
- References:
- perl bug with references
- From: dt
- perl bug with references
- Prev by Date: Re: sysread & eof
- Next by Date: decode a string to "Perl's internal form" without Encode module?
- Previous by thread: Re: perl bug with references
- Next by thread: Re: perl bug with references
- Index(es):
Relevant Pages
|