My perl does not support transliteration?

F

fl

Hi,
I am new to perl. I try to use transliteration with the lines:

#!/usr/bin/perl
# matchtest2.plx
use warnings;
use strict;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful.
(3)';

my $string =~ tr/0123456789/abcdefghij/;

But it respondes back:

Use of uninitialized value in transliteration (tr///) at
matchtest21.plx line 9.


What is wrong with my code? I run perl on WinXP. Thanks.
 
S

Scott Bryce

Hi,
I am new to perl. I try to use transliteration with the lines:

#!/usr/bin/perl
# matchtest2.plx
use warnings;
use strict;

$_ = '1: A silly sentence (495,a) *BUT* one which will be useful.
(3)';

my $string =~ tr/0123456789/abcdefghij/;

But it respondes back:

Use of uninitialized value in transliteration (tr///) at
matchtest21.plx line 9.


What is wrong with my code? I run perl on WinXP. Thanks.


You are trying to do the transliteration on $string, which does not
contain a value.


#!/usr/bin/perl
# matchtest2.plx
use warnings;
use strict;

my $string = '1: A silly sentence (495,a) *BUT* one which will be useful.
(3)';

$string =~ tr/0123456789/abcdefghij/;

print $string;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top