An executable example:
use strict;
#create the exclusion hash outside of loop
#much cheaper than recreating though each pass inside of loop!
my %excluded_tables = ( 'SYSTEM' => 1,
'OBJECTS' => 1 );
my @tables = qw(PEOPLE PLACES THINGS OBJECTS CONTACTS CUSTOMERS SYSTEM
+);
#foreach my $table_name (@tables) would be fine, too.
#assigning vars the value of $_ inside of a loop is kind of funky
for (@tables) {
unless (exists $excluded_tables{$_}) {
print "Assigning vars for $_\n";
my ($table_1, $table_2, $table_3) =
("Table_name_A", "Table_name_B", "Table_name_C");
} else {
print "Skipping $_\n";
}
}
Hanlon's Razor - "Never attribute to malice that which can be adequately explained by stupidity"
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.