nysus has asked for the wisdom of the Perl Monks concerning the following question:
This doesn't work. No idea why:
#! /usr/bin/env perl use strict; use warnings; my $string = "cant"; $string =~ tr//"'"/; print $string . "\n";
Result: "'"can"'"t"'"
Desired result: "can't"
I reread the documentation for tr///. But it still seems like every character on left should be replace with a single corresponding character on the right. What am I missing?
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: tr/// not working for replacment of curly quotes (use utf8)
by LanX (Saint) on Jul 26, 2020 at 21:22 UTC | |
by nysus (Parson) on Jul 26, 2020 at 21:30 UTC | |
by LanX (Saint) on Jul 26, 2020 at 21:35 UTC | |
by jcb (Parson) on Jul 27, 2020 at 03:10 UTC | |
Re: tr/// not working for replacment of curly quotes
by rsFalse (Chaplain) on Jul 28, 2020 at 12:55 UTC | |
Re: tr/// not working for replacment of curly quotes
by Anonymous Monk on Jul 26, 2020 at 21:23 UTC |
Back to
Seekers of Perl Wisdom