"Dan" schreef:
> if (substr($line,0,5) eq "From:")
You don't even need to know that 'From:' is 5 characters, if you use
if ( 0 == index $line, 'From:' )
> i wrote a program some months back which utilised a compelx regex sub
>
> $onchan{lc($data[0])} =~ s/(,|^)\Q$data[1]\E(?=,|$)//;
>
> which substitutes the exact match for $data[1] in a long string which
> is csv, and replace it with nothing. i'm trying to use the same
> routine, or the same method, to get the 'dan' out of
> "dan" [EMAIL PROTECTED]
> but a) the regex confuses me enough to not know how to get that out
> of there (i've replaced the ,'s with "'s, but that's obviously not
> enough), and b) i don't know how to give the regex the full line of
> text, and assign the extracted value into a variable for use later on.
Please give better examples of input and expected output. Use
"example.com" in examples.
This contains a regexp that will remove the non-@ characters from the
start of a string:
echo '[EMAIL PROTECTED]' | perl -pe 's/[EMAIL PROTECTED]//'
See also: perldoc -q strip
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>