Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

srings and REGEXP

Status
Not open for further replies.
I don't know WHY you need to do it on one line, but you can do it like this:
Code:
my $file=$x, $file=~s/$path//;

Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
hi-

i really was looking for a quicker method to do the two steps with one step.

maybe something like:

my $file= ($x =~ s/$path/);

... ?
 
you could also do it like this:
Code:
my ($file) = ($x =~ /$path(.*)/);

$x is not affected. (-:
 
my($file = $x) =~ s/$path//;

There... is that what you are looking for?
$file gets the value of $x and then $file has $path stripped out. $x stays unaltered.

Hope this helps,

--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top