Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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.

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

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 exploiting the Monastery: (6)
As of 2016-06-26 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (327 votes). Check out past polls.