On Mon, 2008-09-22 at 20:16 -0700, Grant wrote:
> what about
>
> $code =~ tr/['"]/["']/;
>
> ?
> >>>
> >>> I shouldn't have said characters. I'm actually trying to switch "'"
> >>> and "'" without the double-quotes. Can that be done as simply as
> >>> your one-liner above
On Mon, 2008-09-22 at 11:08 -0700, John W. Krahn wrote:
> Paolo Gianrossi wrote:
> > what about
> >
> > $code =~ tr/['"]/["']/;
>
> Why are you also replacing '[' with '[' and ']' with ']'?
>
> Perhaps you meant:
>
> $code =~ tr['"]["'];
>
>
Wooops you're right... Sorry for the slightly wron
what about
$code =~ tr/['"]/["']/;
?
>>>
>>> I shouldn't have said characters. I'm actually trying to switch "'"
>>> and "'" without the double-quotes. Can that be done as simply as
>>> your one-liner above?
>>
>> perldoc HTML::Entities
>>
>> Or: http://search.cpan.org/~g
>>> what about
>>>
>>> $code =~ tr/['"]/["']/;
>>>
>>> ?
>>
>> I shouldn't have said characters. I'm actually trying to switch "'"
>> and "'" without the double-quotes. Can that be done as simply as
>> your one-liner above?
>
> perldoc HTML::Entities
>
> Or: http://search.cpan.org/~gaas/HTML-Pars
Grant wrote:
what about
$code =~ tr/['"]/["']/;
?
I shouldn't have said characters. I'm actually trying to switch "'"
and "'" without the double-quotes. Can that be done as simply as
your one-liner above?
perldoc HTML::Entities
Or: http://search.cpan.org/~gaas/HTML-Parser-3.56/lib/HTML/E
>> > what about
>> >
>> > $code =~ tr/['"]/["']/;
>> >
>> > ?
>>
>> I shouldn't have said characters. I'm actually trying to switch "'"
>> and "'" without the double-quotes. Can that be done as simply as
>> your one-liner above?
>
> $code = s{ (['\x22]) }{ '' . ord( $1 ) . ';' }egx;
Thanks but
On Mon, 2008-09-22 at 10:34 -0700, Grant wrote:
> > what about
> >
> > $code =~ tr/['"]/["']/;
> >
> > ?
>
> I shouldn't have said characters. I'm actually trying to switch "'"
> and "'" without the double-quotes. Can that be done as simply as
> your one-liner above?
$code = s{ (['\x22]) }{ '
Paolo Gianrossi wrote:
what about
$code =~ tr/['"]/["']/;
Why are you also replacing '[' with '[' and ']' with ']'?
Perhaps you meant:
$code =~ tr['"]["'];
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short o
Grant wrote:
I'd like to switch the " and ' characters in a block of text so that
all " characters become ' and all ' characters become ". The closest
thing I can come up with is the following, but of course it doesn't
work quite right because one is executed after the other:
$code =~ s/"/'/g;
> what about
>
> $code =~ tr/['"]/["']/;
>
> ?
I shouldn't have said characters. I'm actually trying to switch "'"
and "'" without the double-quotes. Can that be done as simply as
your one-liner above?
- Grant
>> I'd like to switch the " and ' characters in a block of text so that
>> all " cha
On Mon, 2008-09-22 at 10:19 -0700, Grant wrote:
> I'd like to switch the " and ' characters in a block of text so that
> all " characters become ' and all ' characters become ". The closest
> thing I can come up with is the following, but of course it doesn't
> work quite right because one is exec
what about
$code =~ tr/['"]/["']/;
?
Hope it helps :)
cheers
paolino
On Mon, 2008-09-22 at 10:19 -0700, Grant wrote:
> I'd like to switch the " and ' characters in a block of text so that
> all " characters become ' and all ' characters become ". The closest
> thing I can come up with is th
I'd like to switch the " and ' characters in a block of text so that
all " characters become ' and all ' characters become ". The closest
thing I can come up with is the following, but of course it doesn't
work quite right because one is executed after the other:
$code =~ s/"/'/g;
$code =~ s/'/"/
13 matches
Mail list logo