|
|
 |
 |
 |
 |
Perl Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
How to erase Hex value 13 from string?
How to erase Hex value 13 from string? Perl line : $b =~ tr/\013//; dont work?! Thanks
Hex value is 0D, decimnal value is 13
> How to erase Hex value 13 from string? > Perl line : $b =~ tr/\013//; > dont work?! > Thanks
"Taomica" <tom @vvv.xls> wrote in message news:f418ua$na1$1@ss408.t-com.hr... > How to erase Hex value 13 from string? > Perl line : $b =~ tr/\013//; > dont work?!
Untested: $b =~ s/chr(0x013)//; Cheers, Rob
Taomica wrote: > How to erase Hex value 13 from string? > Perl line : $b =~ tr/\013//; > dont work?!
You missed the /d modifier. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
On Jun 4, 11:40 am, "Sisyphus" <sisyph@nomail.afraid.org> wrote: > Untested: > $b =~ s/chr(0x013)//;
Function calls do not interpolate. Paul Lalli
Taomica <tom @vvv.xls> wrote: > Hex value is 0D, decimnal value is 13 >> How to erase Hex value 13 from string? >> Perl line : $b =~ tr/\013//; >> dont work?!
\013 is octal. 0x0D = 13 = \015. Better to use \r if you mean carriage return, though. And as Gunnar said, you need the d modifier: $b =~ tr/\r//d; -- Warren Block * Rapid City, South Dakota * USA
Thanks "It work!!!" Super. "Warren Block" <wbl @wonkity.com> wrote in message news:slrnf68opo.9q7.wblock@speedy.wonkity.com...
> Taomica <tom @vvv.xls> wrote: >> Hex value is 0D, decimnal value is 13 >>> How to erase Hex value 13 from string? >>> Perl line : $b =~ tr/\013//; >>> dont work?! > \013 is octal. 0x0D = 13 = \015. Better to use \r if you mean carriage > return, though. And as Gunnar said, you need the d modifier: > $b =~ tr/\r//d; > -- > Warren Block * Rapid City, South Dakota * USA
"Paul Lalli" <mri @gmail.com> wrote in message news:1180979670.729542.102720@q66g2000hsg.googlegroups.com... > On Jun 4, 11:40 am, "Sisyphus" <sisyph @nomail.afraid.org> wrote: >> Untested: >> $b =~ s/chr(0x013)//; > Function calls do not interpolate.
I must not reply to usenet posts while inebriated. I must not reply to usenet posts while inebriated. I must not reply to usenet posts while inebriated. I must not reply to usenet posts while inebriated. . . I must not reply to usenet posts while inebriated. I must not reply to usenet posts while inebriated. I must not reply to usenet posts while inebriated. :-) Cheers, Rob
Gunnar Hjalmarsson wrote: >Taomica wrote: >> How to erase Hex value 13 from string? >> Perl line : $b =~ tr/\013//; >> dont work?! >You missed the /d modifier.
You missed the fact that \013 is in octal, not in hex. And the OP may just have missed that hex "13" is not decimal 13, which seems like a far more likely candidate to want to delete. -- Bart.
Bart Lateur wrote: > Gunnar Hjalmarsson wrote: >> Taomica wrote: >>> How to erase Hex value 13 from string? >>> Perl line : $b =~ tr/\013//; >>> dont work?! >> You missed the /d modifier. > You missed the fact that \013 is in octal, not in hex.
Since you say that *I* missed, I have to ask: Is there a requirement to cover the whole problem when you try to help here? I didn't even consider the SEARCHLIST, but I know that you need the /d modifier to erase characters with the tr() operator, and I chose to call the OP:s attention to that. Shouldn't I have done so? -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
Gunnar Hjalmarsson wrote: >Since you say that *I* missed, I have to ask: Is there a requirement to >cover the whole problem when you try to help here?
Well, you suggested that tr/\013//d would solve his problem of deleting the character hex "13", which it doesn't. If you don't solve the whole problem, be prepared for corrections. -- Bart.
|
 |
 |
 |
 |
|