develooper Front page | perl.perl6.users | Postings from May 2018

need s/ help

Thread Next
May 1, 2018 13:37
need s/ help
Message ID:
Hi All,

I am trying to change the last three letters of a string

$ perl6 -e 'my $x="abcabcabc"; $x ~~ s/"a.*"$/xyz/; say $x;'

I want abcabcxyz

And, in real life, only the "a" will be a know letter.
Everything else will vary.  And the "a" will repeat a lot.
I am only interested in changing the last "a" and everything
that comes after it.

Many thanks,

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