Re: Perfecting index.pl some more!



Also sprach Nikos:

> Tassilo v. Parseval wrote:

You should use quotation marks to indicate which parts I wrote and which
were yours.

> Also i didnt quite understand what are you tryign to say here!
> Can you please clarify it to em some more?

[quotations inserted for clearity]

>> As you want shorter code, here's one way:
>>
>> s/\n/\\n/g,
>> s/"/\\"/g ,
>> tr/\cM//d ,
>> for $data;

This is functionally equivalent to what you've written, which was:

$data =~ s/\n/\\n/g;
$data =~ s/"/\\"/g;
$data =~ tr/\cM//d;

By using 'for $data', $data gets aliased to $_ which is the default
variable that s/// and tr/// act upon. By using 'for' as a
statement-modifier (that is: in postfix notation) no block is needed
which would normally be the case if you wrote:

for ($data) {
s/\n/\\n/g;
s/"/\\"/g;
tr/\cM//d;
}

Tassilo
--
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);
.



Relevant Pages