Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: glob quietly fails

by QM (Vicar)
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.

-QM
--
Quantum Mechanics: The dreams stuff is made of


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2015-07-02 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls