--- "J. Patrick Lanigan" <[EMAIL PROTECTED]> wrote:
> I haven't quite sorted out the more complex data structure in perl
> yet. Anyhow, I need to take the following hash of arrays...
>
> my %tracks = ();
>
> push @{$tracks{$filename}},
> $_, # tracks.filename
> $File::Find::dir . '/', #
> tracks.filepath
> $artist, # artist.artist_name
> $album, # album.title
> $tracknum, # tracks.track_num
> $title, # tracks.title
> $genre; # tracks.title
try
$tracks{$filename} = [ $_, $artist, $foo, $blah ];
then to get back $foo, use
$tracks{$filename}[2];
square brackets return a reference to an anonymous array.
curly braces do the same with hashes, so you could even say
$tracks{$filename} = { artist => $artist,
genre => $genre, # etc, etc....
};
and then retrieve the pieces named like this:
print $tracks{$filename}{artist};
That should be a little easier to read.
check perldoc perlref.
> ...and then extract the data...(This isn't working)
>
> for my $row ( keys %tracks ){
> (my $qualified_filename, my $filename, my $filepath, $artist,
^^^^
is that an oops? =o)
> $album,..., $title, $genre) = "$row @{ $tracks{$row} }";
Ah. It's the quotes. ^ ^
That makes it a single scalar value, which gets dumped into your first
field.
> {
^ oops again? lol....
> ...what I end up with, is ALL my data in $qualified_filename.
quotes.
Good luck!
Paul
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/