Is it possible to rewrite this perl subroutine without using variables?

sub XMLEncode {
    my ($line) = @_;
    $line =~ s/&/&/g;
    $line =~ s/</&lt;/g;
    $line =~ s/>/&gt;/g;
    return $line;
}

I was thinking something like

sub XMLEncode {
    s/&/&amp;/g;
    s/</&lt;/g;
    s/>/&gt;/g;
    return $_;
}

but I can't get it to work like that.

-Philip Mak ([EMAIL PROTECTED])

Reply via email to