Perl throws an error message about syntax

Posted by Ben Dauphinee on Stack Overflow See other posts from Stack Overflow or by Ben Dauphinee
Published on 2010-06-13T02:04:51Z Indexed on 2010/06/13 2:12 UTC
Read the original article Hit count: 302

Filed under:
|
|
|

So, building off a question about string matching (this thread), I am working on implementing that info in solution 3 into a working solution to the problem I am working on.

However, I am getting errors, specifically about this line of the below function:

next if @$args->{search_in} !~ /@$cur[1]/;

syntax error at ./db_index.pl line 16, near "next "

My question as a perl newbie is what am I doing wrong here?

sub search_for_key
{
    my ($args) = @_;

    foreach $row(@{$args->{search_ary}}){
        print "@$row[0] : @$row[1]\n";
    }

    my $thiskey = NULL;
    foreach $cur (@{$args->{search_ary}}){
        print "\n" . @$cur[1] . "\n"
        next if @$args->{search_in} !~ /@$cur[1]/;
        $thiskey = @$cur[0];
        last;
    }
    return $thiskey;    
}

© Stack Overflow or respective owner

Related posts about perl

Related posts about arrays