Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
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 (Prior) 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 chilling in the Monastery: (15)
As of 2014-08-27 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (244 votes), past polls