(yes, I know it needs to be cleaned up) My script works, but I'm trying to move stuff around so that the variables can be accessed outside the block. Here's what I have now, that works:
...open the file...
my %menuhash1 = ();
my @fields1 = split(/\t/, <FILE>); chomp @fields1;
my @records1;
my $prodlisting;
my %ref1;
while(<FILE>) {
chomp;
my @row1 = split(/\t/);
my %data1;
@data1{@fields1} = @row1;
chomp @row1;
push @records1, \%data1;
}
close (FILE);
foreach my $ref1 (
sort {(-1,0,1)[rand 3]} @records1
){
my $thumbgif = "thumb.gif";
my $menudir = "$ref1->{'dir'}";
$menudir = "$menudir/";
my $thumb = "$webdir\/$menudir$thumbgif";
print "<img align=\"center\" border=\"0\" src=\"$thumb\">";
etc...
I'm trying to move the "my's" outside the block. $menudir is the problem.
Maybe I just need a nap.
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.