http://www.perlmonks.org?node_id=186835


in reply to Remove from character to end of line

you have the s/// operator in perl. this should do what you want:
while(<>) { s#^([^/]+).*#$1#; print; }

hope this helps,

Update: even if the s/// works, split() is faster:

while(<>) { print((split '/')[0], "\n"); }

Update: ++Abigail-II. I need to work on my golfing skills... ;)