in reply to Re: Extract a small part of a long sentence using regular expressions
in thread Extract a small part of a long sentence using regular expressions

Thank you! The fact that one small thing in Perl can be figured out in so many different ways give me the creeps! This is a very intersting approach and i must admit i had not thought of this...

Just one question though, this magic alpha incrementer, i don't get it. Is it liek a normal counter where we say  $count = 1; and then increment it or is this something different??

  • Comment on Re^2: Extract a small part of a long sentence using regular expressions
  • Download Code

Replies are listed 'Best First'.
Re^3: Extract a small part of a long sentence using regular expressions
by Myrddin Wyllt (Hermit) on Dec 02, 2014 at 23:22 UTC

    It is like a normal incrementer but it works on string variables, which is the 'magical' part. The variable has to only have been used in string context since it was set and match the pattern:

    /^[a-zA-Z]*[0-9]*$/

    and not be the null string. It's pretty much designed for cases like this. If you have more than 26 keys, it will go from 'z' to 'aa' and so on. The autodecrement operator (--) ISN'T magical, and I don't think the incrementer works on Unicode, but it's still pretty cool.