BadMojo has asked for the wisdom of the Perl Monks concerning the following question:

Hey I am hoping this one isn't in the FAQ, lol, can some one please tell me why this code is broken? I get the following error "Transliteration replacement not terminated at nsendv2.pl line 60" Line 60 is in bold Below.
sub LocalTest { my $returnval=0; my $msg=SetMessage(); use Socket; use Sys::Hostname; my $host = hostname(); SendMessage( $host, $msg); print "Did your rescive the message?(y/n): "; $key=<STDIN>; chomp $key; if ( $key eq y || $key eq Y ){ <b>return $returnval;</b> } else { $returnval=1; return $returnval; } }

20050505 Janitored by Corion: Put code in between code tags

BadMojo
mford@badmojo.biz
www.badmojo.biz

!=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-!
When something works but shouldn't thats BADMOJO baby.

Replies are listed 'Best First'.
Re: Something is wrong
by bart (Canon) on May 05, 2005 at 13:58 UTC
    It's the bareword y. Just quote those strings. (see y)
    if ( $key eq 'y' || $key eq 'Y' ){
Re: Something is wrong
by deibyz (Hermit) on May 05, 2005 at 14:01 UTC
    You're using a lone y, without quotes, if the if above, and thus Perl takes it as part of a y/// transliteration. Try with qoutes. More at perlop.

    Also, please have a look at Writeup Formatting Tips, code is hard to read without <code> tags =o(.

Re: Something is wrong
by polettix (Vicar) on May 05, 2005 at 14:39 UTC
    BadMojo, just to elaborate a bit about cog's answer, please take a look at the relevant documentation about posting here in PerlMonks FAQ. In particular: That said, welcome to PM and may your Mojo enhance with time :)

    Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

    Don't fool yourself.
Re: Something is wrong
by dragonchild (Archbishop) on May 05, 2005 at 14:04 UTC
    You're not using strict, otherwise it would have caught that error for you. :-)

    • In general, if you think something isn't in Perl, try it out, because it usually is. :-)
    • "What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?"
Re: Something is wrong
by cog (Parson) on May 05, 2005 at 14:12 UTC
    Something is wrong

    It's probably the node title.