[Israel.pm] perl -i -pe question

Avishalom Shalit avishalom at gmail.com
Sun Feb 19 23:41:26 PST 2012


sorry , didn't read as far as the if

what are you trying to do ?


-- vish




On 20 February 2012 07:40, Avishalom Shalit <avishalom at gmail.com> wrote:

> because you are setting it to 1 every line
>
> try ...BEGIN{$a=1};a++
>
>
>
> better yet , why not use $. ?
> this is the current line
> -- vish
>
>
>
>
>
> On 20 February 2012 07:33, Dov Levenglick <dov.levenglick at gmail.com>wrote:
>
>> Why isn't $a incrementing in this one-liner:
>> perl -ibak -pe "$a=1; $a++ if (s/   ADDR_RESET_PAIR/    $a
>> ADDR_RESET_PAIR/);" file.txt
>>
>> Running this on Win7 (This is perl, v5.6.1 built for
>> MSWin32-x86-multi-thread)
>>
>> I know it's an antiquated version of Perl, but it's what the company uses.
>>
>>
>> Best Regards,
>> Dov Levenglick
>> _______________________________________________
>> Perl mailing list
>> Perl at perl.org.il
>> http://mail.perl.org.il/mailman/listinfo/perl
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20120220/5e68ef3a/attachment.htm 


More information about the Perl mailing list