Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Several suggestions:
  • The -s switch to Perl allows you to use simple options at the command-line:
    % perl -s -e 'print $A, $B' -- -A -B=hello 1hello
  • Don't call perl from perl unless you have a good reason to. If you want to emulate Perl's in-place editing, then do so.
Here's my offering:
#!/usr/bin/perl -spi use strict; use vars qw( $gif $blink ); my $files; BEGIN { unless ((defined $gif or defined $blink) and @ARGV) { (my $exec = $0) =~ s!.*/!!; exit warn "usage: $exec [ -gif=[1|0] ] [ -blink=[1|0] ] files...\n +"; } $files = "@ARGV"; } if (defined $gif) { if ($gif) { s/ANIMEXTZ1\.0/ANIMEXTS1.0/, s/NOTSCAPE2\.0/NETSCAPE2.0/ + } else { s/ANIMEXTS1\.0/ANIMEXTZ1.0/, s/NETSCAPE2\.0/NOTSCAPE2.0/ } } if (defined $blink) { if ($blink) { s/blynk/blink/ } else { s/blink/blynk/ } } END { printf "Animated GIFs are %sabled in $files\n", ("dis","en")[$gif] if defined $gif; printf "Blinking text is %sabled in $files\n", ("dis","en")[$blink] if defined $blink; }
I'll comment on (or explain) the code as requested.


In reply to RE: Disable animated GIFs and blinking text in Netscape by japhy
in thread Disable animated GIFs and blinking text in Netscape by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (3)
    As of 2018-05-25 19:41 GMT
    Find Nodes?
      Voting Booth?