Dan, Maybe you want to do a series of smaller regexes, rather than one large one?
For example: sub rmgtlt { $_[0] =~ s/^\<|\>$//g; $_[0] =~ s/[\n\r]//$g; $_[0] =~ s/\s$//g; return $_[0]; } Just a thought that might make it more clear where the problem is. Also, what do you mean by "on one line?" do you mean without \n or \r's anywhere in the string? -------------------------- David Olbersen iGuard Engineer 11415 West Bernardo Court San Diego, CA 92127 1-858-676-2277 x2152 > -----Original Message----- > From: Dan Muey [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 11, 2003 9:00 AM > To: [EMAIL PROTECTED] > Subject: return a regex substitution in one line > > > 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? > I know I must be missing something obvious , thanks for any guidance! > > Dan > > -- > 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]