Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: weird begginer's problem...

by Khen1950fx (Canon)
on Sep 06, 2012 at 16:29 UTC ( #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); }


Comment on Re: weird begginer's problem...
Download Code
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
Node Status?
node history
Node Type: note [id://992138]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-04 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls