lo gain monks.
After reading a little about; use strict I am still confussed. Other than just declairing my variables about the place in a seemingly useless way can I get my scripts to run with this option and I fail to see the reason (I am sure there is a good one). I thought I'd try a different approach. Take the following horribly written script of mine (it works but pick it to bits if you like). What would be the most logical way to add Use Strict to this and why is that a benefit. If it makes it more readable how is that (how are you expecting to read a script)? I know I should use this option (I keep getting told to) but not really how or why. Does it improve speed? Does it prevent errors and if so how. I know this is a common question but maybe this way someone might answer it in a way we greenies understand (those who are learning without structure but want some like me). Thanks, I'm all for a good idea if I can understand and use it. Paw
use File::Find; $feeddir = "c:/orant8"; chdir("$feeddir"); find(\&wanted, "$feeddir"); sub wanted { m/TNSNAMES.ORA/i or return; Details($File::Find::name); } sub Details { $file = shift; open(CLEAN, "$file"); @cleanup = <CLEAN>; for ($i = 0; $i < scalar(@cleanup); $i++) { $cleanup[$i] =~ s/oldserv001/newserv001/ig; $cleanup[$i] =~ s/oldserv002/newserv002/ig; $cleanup[$i] =~ s/oldserv003/newserv003/ig; $cleanup[$i] =~ s/oldserv004/newserv004/ig; $cleanup[$i] =~ s/oldserv005/newserv005/ig; $cleanup[$i] =~ s/oldserv006/newserv006/ig; $cleanup[$i] =~ s/oldserv2001/newserv2001/ig; $cleanup[$i] =~ s/oldserv2006/newserv2002/ig; $cleanup[$i] =~ s/oldserv2008/newserv2003/ig; $cleanup[$i] =~ s/oldserv2009/newserv2004/ig; $cleanup[$i] =~ s/oldserv2010/newserv2005/ig; $cleanup[$i] =~ s/oldserv2011/newserv2006/ig; $cleanup[$i] =~ s/oldserv2012/newserv2007/ig; $new[$i]=$cleanup[$i]; } close CLEAN; } open(WRITE, "> $file"); print WRITE @new;

Edit by tye, title, add READMORE


In reply to Add use strict to this? by ironpaw

Title:
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, details, 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, summary, 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.