Think about Loose Coupling | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I rather think of qw as quote whitespace since what it does is break up the subject string using whitespace as separators. So the string inside the qw() is broken into 3 pieces, not 3 words as in this case each resulting piece contains 2 words and some square brackets. See perlop under Quote and Quote-like operators.
The next think you need to know is that \Q and \E are allowing you to use the content of the variable $what as literal text without interpreting any special characters, which in this case are the square brackets. Have a look at perlre to see what [box] means inside a regular expression. So in summary it is looking for the string [box] including the square brackets, withing the 3 separate strings in[box], out[box], and white[sox], and prints matches. -- In reply to Re: I don't understand a piece of this code
by Albannach
|
|