Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Get certain information from MP3::Tag's autoinfo()

by toolic (Chancellor)
on Aug 07, 2012 at 19:19 UTC ( #986062=note: print w/ replies, xml ) Need Help??


in reply to Get certain information from MP3::Tag's autoinfo()

From MP3::Tag POD:

autoinfo() returns an array with the information or a hashref. The hash has four keys 'title', 'track', 'artist' and 'album' where the information is stored. If comment, year or genre are found, the hash will have keys 'comment' and/or 'year' and/or 'genre' too.

Try:

my $info = $mp3->autoinfo(); # hashref print $info->{album}; print $info->{artist};

See also:


Comment on Re: Get certain information from MP3::Tag's autoinfo()
Download Code
Re^2: Get certain information from MP3::Tag's autoinfo()
by thmsdrew (Scribe) on Aug 07, 2012 at 19:29 UTC

    So that uses less unnecessary space than my initial way of doing it? Because I'm referencing the hash and not actually declaring all of the variables that I don't need?

      You could do this:

      (undef, undef, $artist, $album) = $mp3->autoinfo();

      But I like toolic's solution better.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986062]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-08-31 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls