Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: glob quietly fails

by QM (Parson)
on Oct 16, 2012 at 12:24 UTC ( #999311=note: print w/ replies, xml ) Need Help??

in reply to Re: glob quietly fails
in thread glob quietly fails

As remiah and Anonymous Monk have stated, I expected while and for to behave the same way, and they do for me, on Strawberry Perl v5.16.1:

#!/usr/env/perl use strict; use warnings; my $q = (shift or 129); # 128 is the largest working value my @x = ( 'A' x $q, 'B' x $q ); my $glob = '{' . join(',', @x) . '}'; while (my $g = glob($glob)) { print "while: $g\n"; } for my $g ( glob( $glob ) ) { print "for: $g\n"; } __EOF__ ################# # result: # while: for:

Running this with a command line argument of 128 gives the expected output of 2 very long strings for while and 2 for for.

Quantum Mechanics: The dreams stuff is made of

Comment on Re^2: glob quietly fails
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999311]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2015-11-25 18:23 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (684 votes), past polls