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

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); }

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-06-19 00:06 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.