Fucking traitorous scum

you are viewing a single comment's thread
view the rest of the comments
[–] 12 points 1 day ago (8 children)

I know I do, but I started with perl

Throwing rocks from a glass house I see ;)

  • source
  • parent
  • hideshow 8 child comments
  • [–] 3 points 1 day ago (7 children)

    Perl has scope delimiters, so a sturdy glass house.

  • source
  • parent
  • hideshow 7 child comments
  • [–] 2 points 15 hours ago (3 children)

    I genuinely love the idea of the $1 after a match. It feels so natural in perl! So many things are text matching.

    But! But! But!! Those $ variables are dynamic scoped! If you call a method and it matches stuff you lose the variables!

    I'll bet there is a way around it. But it made me so sad.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 4 hours ago (2 children)

    Yes, regex handling in Perl is the smoothest I have ever seen, and it matched the first description I heard of perl as "the best tool for text processing". I have done big things with that.

    Those $ variables are dynamic scoped! If you call a method and it matches stuff you lose the variables!

    My match scopes typically looked like so:

    if ($inString =~ /^([ \t]+)(.*)$/) {
        my $indent = $1;    # store first match
        my $remainder = $2; # store second match
        
        # do stuff
    }
    

    (not tested, just edited by hand to anonymise)

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 4 hours ago (1 child)

    I think it came up more like

    if ($inString =~ /^([ \t]+)(.*)$/ && has_a_cow($2)) {
    

    For me. I dunno. I was never good at perl. I just wanted to hack something together.

  • source
  • parent
  • hideshow 1 child comment