in reply to Removing data from a string with Regex
Instead of using substitution, you might try something like this:
The first line will take all the characters starting from the beginning of $from that aren't '@' and capture them to the special variable $1. Then, reassign $from to the value of $1.
To do this with substitution, you could try:
Hope this helps!
--jwest
$from =~ /^([^@]+)@/; $from = $1;
The first line will take all the characters starting from the beginning of $from that aren't '@' and capture them to the special variable $1. Then, reassign $from to the value of $1.
To do this with substitution, you could try:
which would substitute the '@' and anything that followed with nothing.$from =~ s/@.*//;
Hope this helps!
--jwest
-><- -><- -><- -><- -><- All things are Perfect To every last Flaw And bound in accord With Eris's Law - HBT; The Book of Advice, 1:7
In Section
Seekers of Perl Wisdom