Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: weird begginer's problem...

by Khen1950fx (Canon)
on Sep 06, 2012 at 16:29 UTC ( [id://992138]=note: print w/replies, xml ) Need Help??


in reply to weird begginer's problem...

You'll need to declare $cue_file_found, and you'll also need to use strictures. I ran this and got no errors:
#!/usr/bin/perl use strict; use autodie; use warnings; sub exractSongTitlesFromCueFile { my ( $cue_file_to_parse ) = @_; my @album_info; my $w = 0; my $cue_file_found = '/tmp/cue/cue_file'; open( CUEFILEFOUND, '<', $cue_file_found ) or die "Could not open cue file named: $cue_file_found! $!\n"; while (<CUEFILEFOUND>) { if ( $_ =~ /\s+TITLE "(.*)".*/ ) { $album_info[$w] = $1 || die "Error 004: Couldn't assign song title to array! $!\n"; $w++ || die "Error 005: Could not increment array pointer $!\n"; } } close(CUEFILEFOUND); return (@album_info); }

Replies are listed 'Best First'.
Re^2: weird begginer's problem...
by MidLifeXis (Monsignor) on Sep 06, 2012 at 16:41 UTC

    Does not seem correct, just based on reading, as this version has the same root-cause issue as the first: the $w++ starts out at zero, causing the die to fire the first time through the loop where the TITLE matches.

    --MidLifeXis

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found