Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I know how to find a word on a line...
if ($line =~ /\b$word\b/){}
The second thing i would like to know is how do I remove the first char from a string in an array element?
I would have something like "10000001", but i want the first '1' to no longer exist so it will read "0000001". It must be the first char as sometimes there maybe letters there or special chars (e.g. -, +, $) that i dont want. I was thinking of using split which will work but i thought there must be some regular expression that is much more efficient (As u can guess, regular expressions are not my strong point!).
The third thing is i want to remove all chars up to the last ',' in an array element. For example, if I have:
"","","hello, my name is Bob, my cell number is, 1234567890",""
These are probably easy to solve for u perl guru's out there, but for us lowly apprentices its not so easy! I must get to grips with these god damn regex, can anyone recommend a decent book that can explain this sorta stuff for people as mentally challenged as myself?! (No books for dummies please, i dont need my mental capacity challenged by patronising yellow books with kiddie pics plastered over it! ;-))
Thanks peeps, Chad :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Not find a word / remove first char in string / remove last value in list
by Corion (Patriarch) on Nov 18, 2003 at 11:33 UTC | |
|
Re: Not find a word / remove first char in string / remove last value in list
by broquaint (Abbot) on Nov 18, 2003 at 11:27 UTC | |
|
Re: Not find a word / remove first char in string / remove last value in list
by Roger (Parson) on Nov 18, 2003 at 11:26 UTC | |
|
Re: Not find a word / remove first char in string / remove last value in list
by Art_XIV (Hermit) on Nov 18, 2003 at 14:11 UTC |