SPUG: newbie question over here
Kevin Fink
kevin at n2h2.com
Fri Aug 6 14:30:35 CDT 1999
"next" only works within a block (usually a loop). "unless" isn't a loop
construct - try "while" or "until" instead.
Kevin
On Fri, 6 Aug 1999, Ryan Forsythe wrote:
> hi there...this is my first post to this list, so be nice...
>
> i've been (trying) to teach myself perl over the last few weeks, and i've been
> getting somewhere. however, for the last few days i've been plagued by this
> problem with the 'next if <statement>' command. i've pored over the camel book
> and all the FAQs i can find...i still can't figure out what i'm doing wrong.
> any help would be greatly appreciated (and contribute postively to my mental
> health)
>
> here's the chunk of my code that wigs out:
>
> if ($queryLine =~ m/^$/) {
> unless ( !($dbaseLine = <ACCOUNTS>) && ($dbaseLine =~ m/^$/) && ($count >= $maxRecords) ) {
> $count++;
>
> #i've used the pound sign as comment in the dbase, so if it's the first char in the record
> #i skip the record line.
> next if $dbaseLine =~ m/^#/;
>
> ....more code....
>
> }
> }
>
> and i get this error from the compiler:
> Can't "next" outside a block at findacct.pl line 34, <ACCOUNTS> chunk 1.
>
> (line 34 is the line beginning with 'next if...')
>
> thanks in advance
> --ryan
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
> Email to majordomo at pm.org: ACTION spug-list your_address
>
>
------------------------------------------------------------------------------
Kevin Fink <kevin at n2h2.com> N2H2, Creators of Bess and Searchopolis
Chief Technology Officer 900 Fourth Avenue, Suite 3400
http://www.n2h2.com/ Seattle, WA 98164
VOICE: 206-336-1501 / 800-971-2622 FAX: 206-336-1541
------------------------------------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list