develooper Front page | perl.perl5.porters | Postings from January 2012

[perl #108398] Odd behavior of regex match against in-memory file

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
January 16, 2012 18:16
Subject:
[perl #108398] Odd behavior of regex match against in-memory file
Message ID:
rt-3.6.HEAD-14510-1326766608-548.108398-15-0@perl.org
On Mon Jan 16 17:09:30 2012, jwdevel@gmail.com wrote:
> This is a bug report for perl from jwdevel@gmail.com,
> generated with the help of perlbug 1.39 running under perl 5.14.1.
> 
> 
> -----------------------------------------------------------------
> When I run the following code, I get 'no' printed out, which is not
> what I expect.
> 
>         my $memory_file;
>         my $fh;
>         open ($fh, '>', \$memory_file);
>         print $fh "abc";
>         if( $memory_file =~ m/^.*$/ )
>         { print "yes\n" }
>         else
>         { print "no\n" }
> 
> This issue is discussed in more detail online:
> 
>         http://stackoverflow.com/questions/8649916/perl-writing-to-a-
> memory-file-plays-tricks-with-pattern-matching/8650519
>         http://perlmonks.org/?node_id=945256
> 
> Some builds of perl 5.14.1 do not have this issue, others do (see
> discussion at PerlMonks link)
> 

My results:

Darwin/PPC, Perl 5.14.2: yes
Linux/i386, Perl 5.14.2: no

Since Darwin/PPC is bigendian (per my Parrot %PConfig) while Linux/i386
is not, could this be an endian-ness issue?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=108398

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About