more useful options | |
PerlMonks |
Re: What does $_ = qq~"$_"~ do?by 1nickt (Canon) |
on May 27, 2019 at 18:36 UTC ( [id://11100595]=note: print w/replies, xml ) | Need Help?? |
Hi, You can try it! It's forcing the string to include leading and trailing double quotations marks as part of the string. The use of the tilde character to define the start and end of what's passed to qq) is just a style choice and doesn't affect the code. ( In this case, the code is doing so if the string contains a comma, so it is undoubtedly a misguided attempt to manually escape values in a delimited file. You should never attempt to do that yourself, as it's more complicated that it might seem. Instead, use a module designed for handling delimited files, such as Text::CSV. Hope this helps!
The way forward always starts with a minimal test.
In Section
Seekers of Perl Wisdom
|
|