[Chicago-talk] Could someone explain this

Jim Jacobus JJacobus at PonyX.com
Thu Jun 28 10:21:25 PDT 2018


Hi,
I'm embarrassed to ask this, but I'd like to understand this piece of code.

I want to find out how many times a certain substring appears in the 
string ($block). $block is a very long string that is part of an XML file.
I found this when rooting around for an example:

my $count = () = ( $block =~ m/\<category\>/g);

It does work. $count gives me the number of times the substring 
appears in $block.
However, I don't undstand how this works. What is "= () =" mean.

Jim


More information about the Chicago-talk mailing list