Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

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
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.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (14)
As of 2015-12-01 10:15 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (798 votes), past polls