Dan Muey wrote:
>
> I have this subroutine and it does what I need ::
>
> print rmgtlt($var);
>
> sub rmgtlt {
>
> $_[0] =~ s/^\<|\>$|\n|\r|\s$//g;
> return $_[0];
> }
>
> Is there a way to so the substitution and return the result in one line?
>
> Like ::
>
> sub rmgtlt {
> return ??? $_[0] =~ s/^\<|\>$|\n|\r|\s$//g;
> }
>
> I tried using parenthesis and using list context ::
> return my($q) = $_[0] =~ s/(^\<|\>$|\n|\r|\s$)//g; }
>
> And you might have figured it returned the number of elements matched and not
> the newly fixed up variable contentes.
>
> Is there a way to do this?
sub rmgtlt { join '', split /^<|>$|\n|\r|\s$/, $_[0] }
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]