Scripting Best Practices - page 2
Treat Your Variables Right
A perl-specific tip: the single most helpful thing you can do for yourself is to use these lines in every script:
#!/usr/bin/perl -w use strict;The -w flag turns on warnings. This means that if perl sees something that it thinks looks dubious (e.g. variables mentioned only once), it'll tell you so.
use strict requires you to declare all your variables before (or at least at) their first use. Thus,
my $newvar; // some stuff $newvar = 3;will be AOK, as would my $newvar = 3. But $newvar = 3 without the declaration (or a local declaration) will cause an error. This is fantastic for avoiding typos or variable name brain-blips: if you declared $newvar and then use $newcar a few lines down, you'll be warned.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linux 3.10 Goes Long, Linux 3.11 Advances as LXDE Merges
- 3Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 4Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 5Linux Top 3: Linux 3.11, Kubuntu Goes Commercial