• 'glob' does not expand as I want

    From gamo@21:1/5 to All on Mon Nov 1 17:33:36 2021
    #!/usr/bin/perl -w

    use 5.032; # hapens in 5.030 too

    my @A= glob "{apple,tomato,cherry}={green,yellow,red}";
    say "@A";

    my $b1 = join(",", 1..1000);
    my $b2 = join(",", "a".."z");

    my @B = glob "{$b1}={$b2}";
    my @C;
    for (@B){
    @C = split /=/;
    say "@C";
    }

    exit 1;

    __END__

    This does not works as I expected because if I change 1000 by 10000
    nothing is printed. Somewhere I reach an unexpected limit.

    TIA

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: figure it out. "'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to gamo@telecable.es on Mon Nov 1 18:53:01 2021
    In comp.lang.perl.misc, gamo <gamo@telecable.es> wrote:
    my $b1 = join(",", 1..1000);
    my $b2 = join(",", "a".."z");

    my @B = glob "{$b1}={$b2}";
    my @C;
    for (@B){
    @C = split /=/;
    say "@C";
    }
    ...
    This does not works as I expected because if I change 1000 by 10000
    nothing is printed. Somewhere I reach an unexpected limit.

    Um, don't do that? The glob function is specifically for filenames
    and using it in other ways I suspect is not well supported. I'm going
    to guess your "unexpected limit" is the ARG_MAX value in limits.h.

    perldoc -f glob says "see File::Glob" and perldoc File::Glob talks
    about the various limits.

    For your use case, that's fairly simple function to implement in pure
    perl.

    Elijah
    ------
    has literally never used the glob function

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From gamo@21:1/5 to All on Tue Nov 2 11:15:43 2021
    El 1/11/21 a las 19:53, Eli the Bearded escribió:
    Um, don't do that? The glob function is specifically for filenames
    and using it in other ways I suspect is not well supported. I'm going
    to guess your "unexpected limit" is the ARG_MAX value in limits.h.

    perldoc -f glob says "see File::Glob" and perldoc File::Glob talks
    about the various limits.

    For your use case, that's fairly simple function to implement in pure
    perl.

    Thank you. Yes, a pair of 'for' would do the job,
    but I was curious about that combinational feature.

    --
    http://gamo.sdf-eu.org/
    perl -E 'say "Error: https not supported."'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eric Pozharski@21:1/5 to Eli the Bearded on Tue Nov 2 10:15:55 2021
    with <eli$2111011453@qaz.wtf> Eli the Bearded wrote:
    In comp.lang.perl.misc, gamo <gamo@telecable.es> wrote:

    my $b1 = join(",", 1..1000);
    my $b2 = join(",", "a".."z");

    my @B = glob "{$b1}={$b2}";
    my @C;
    for (@B){
    @C = split /=/;
    say "@C";
    }
    ...
    This does not works as I expected because if I change 1000 by 10000
    nothing is printed. Somewhere I reach an unexpected limit.

    Um, don't do that? The glob function is specifically for filenames and
    using it in other ways I suspect is not well supported. I'm going to
    guess your "unexpected limit" is the ARG_MAX value in limits.h.

    I disagree. Clearly, there are limits (check this, hilarious:)

    perl -wE '
    $aa=join",",1..1030;
    $ab=join",","a".."z";
    say glob "{$aa}={$ab}"'

    but those limits are of "csh implementation in Perl". Unfortunately,
    those are behind XS (IOW, too much trouble to look for, at the moment,
    may be in a couple of months).

    perldoc -f glob says "see File::Glob" and perldoc File::Glob talks
    about the various limits.

    Those are flags, except "GLOB_LIMIT". Aging zsh 4.3.17 just happily
    expanded "{1..10000}={a-z}" (needs tweaking though) and happily passed it
    to "command echo".

    For your use case, that's fairly simple function to implement in pure
    perl.

    Totaly agree. Somehow I don't see it happening (I might be
    over-pessimistic though).

    --
    Torvalds' goal for Linux is very simple: World Domination
    Stallman's goal for GNU is even simpler: Freedom

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Otto J. Makela@21:1/5 to Eli the Bearded on Tue Nov 2 15:46:58 2021
    Eli the Bearded <*@eli.users.panix.com> wrote:

    In comp.lang.perl.misc, gamo <gamo@telecable.es> wrote:
    my $b1 = join(",", 1..1000);
    my $b2 = join(",", "a".."z");

    my @B = glob "{$b1}={$b2}";
    my @C;
    for (@B){
    @C = split /=/;
    say "@C";
    }
    ...
    This does not works as I expected because if I change 1000 by 10000
    nothing is printed. Somewhere I reach an unexpected limit.

    Um, don't do that? The glob function is specifically for filenames
    and using it in other ways I suspect is not well supported. I'm going
    to guess your "unexpected limit" is the ARG_MAX value in limits.h.

    perldoc -f glob says "see File::Glob" and perldoc File::Glob talks
    about the various limits.

    At least for my rather old v5.16.3 "perldoc -f glob" also says:

    If non-empty braces are the only wildcard characters used in the
    "glob", no filenames are matched, but potentially many strings
    are returned. For example, this produces nine strings, one for
    each pairing of fruits and colors:
    @many = glob "{apple,tomato,cherry}={green,yellow,red}";

    So "other ways" than filenames are at least minimally supported.
    --
    /* * * Otto J. Makela <om@iki.fi> * * * * * * * * * */
    /* Phone: +358 40 765 5772, ICBM: N 60 10' E 24 55' */
    /* Mail: Mechelininkatu 26 B 27, FI-00100 Helsinki */
    /* * * Computers Rule 01001111 01001011 * * * * * * */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)