[OT] How to write this perl sub w/o variables?

2001-04-29 Thread Philip Mak
Is it possible to rewrite this perl subroutine without using variables? sub XMLEncode { my ($line) = @_; $line =~ s//amp;/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;

Re: [OT] How to write this perl sub w/o variables?

2001-04-29 Thread Honza Pazdziora
On Sun, Apr 29, 2001 at 04:34:40AM -0400, Philip Mak wrote: I was thinking something like sub XMLEncode { local $_ = shift; s//amp;/g; s//lt;/g; s//gt;/g; return $_; } -- Honza

Re: [OT] How to write this perl sub w/o variables?

2001-04-29 Thread Stas Bekman
On Sun, 29 Apr 2001, Philip Mak wrote: Is it possible to rewrite this perl subroutine without using variables? sub XMLEncode { my ($line) = @_; $line =~ s//amp;/g; $line =~ s//lt;/g; $line =~ s//gt;/g; return $line; } I was thinking something like sub XMLEncode {