> > 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;
> > }
> >
> > Is there a way to do this?
> > I know I must be missing something obvious , thanks for any
> guidance!
>
> Without more comments or sample data, I'm not really sure
> what your function is doing, but here are some things to try:
The regex doesn't matter really it could be s/^\d// to remove the a digit in the
front.
But heres more detail
my $var = "<hello blah blah balh>\nHI ";
print "-$var-";
#OUTPUT
#-<hello blah blah balh>
#HI -
$var = rmgtlt($var);
print "-$var-";
# OUTPUT
#-hello blah blah balhHI-
But like I said the regex doesn't matter I want to return
the result of the substituion regardless of what regex is there
In one line if possible.
I'll try your suggestions, thanks
Dan
>
> sub rmgtlt {
> $_[0] =~ s/^\<|\>$|\n|\r|\s$//g;
> }
>
> sub rmgtlt {
> return $_[0] =~ s/^\<|\>$|\n|\r|\s$//g;
> }
>
> sub rmgtlt {
> return ($tmp = $_[0]) =~ s/^\<|\>$|\n|\r|\s$//g;
> }
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]