Member Avatar

I have a text file that looks like

Y07976.1/124-271
Y07978.1/48-201

and I want to remove everything after the forward slash such that in the end the text file will look like

Y07976.1
Y07978.1

I am currently learning perl and I think regular expressions are going to be a trouble for awhile but I thought about using

$line=~ s/\W.*//;

but that removes everything after the "." and I want to keep the ".1". I appreciate any help.

Thanks

Recommended Answers

[code]s/\/.*$//[/code]

Jump to Post

All 2 Replies

Member Avatar
s/\/.*$//

thank you -- thank you.