Don't ask to ask, just ask | |
PerlMonks |
Re: Removing data from a string with Regexby scain (Curate) |
on Nov 15, 2001 at 02:13 UTC ( [id://125440]=note: print w/replies, xml ) | Need Help?? |
What you need is $from =~ s/@.+//g;; the ".+" matches
everything from @ to the end of the string.
Scott Minor update: Just to be clear, this is probably not the best way to do this, it just happens to work. Specifically, the .+ matches upto but not including the line feed that is at the end of the string, since it came along to $from from $_. In general, you would probably want to chomp $_ and then explicitly add a "\n" to your print statement, so that it is clear what you are doing.
In Section
Seekers of Perl Wisdom
|
|