I am doing some clean up of data in a file. So, I read each line and check certain conditions and perform the appropriate operation in the file. One of the things I need to do is check for the occurrence of the character $ in the string. If found I need to delete the rest of the line including the $. Example, if the line is
abc$hello-goodbye
I need to get
abc
How do I do this in Perl with minimal code? Use regexp of some sort?
Quickest is by an easy regular expression:
where