develooper Front page | perl.perl6.users | Postings from September 2017

help with map and regexp

Thread Next
Luca Ferrari
September 19, 2017 10:39
help with map and regexp
Message ID:
Hi all,
I'm trying to understand how to use map correctly to apply several
regexps at once, something like:

my @fields = $line.split( ',' ).map: {  s:g/\'//; s:g/^\"|\"$//;  $_ };

while the first regexp works, the second fails with "Cannot modify an
immutable Str", but the topic variable should be considered, not a
literal string.
I would replace it with the S operator, but I believe it would not do
what I want since a new string will be created as output of any
Any suggestion?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About