in reply to RegEx, $1, problem

next if ...

Whenever your match is true,   next   jumps all the rest of your statements and returns to the next iteration of the loop.

Think about whether you need the   next   statement at all. If you do, you'd probably go well with:

if ( $string =~ /(<b>\w|\.+\.zip<\/b>)/ ) { &do_something_with($1); # first next; # next }

Concerning what to match, best you tell us in English what exactly you do mean to match?
Is the pipe character an alternation? Or a literal pipe character? (write "\|" then, see perlre)

Cheers, Sören

Update: corrected the typo ikegami pointed out.

Replies are listed 'Best First'.
Re^2: RegEx, $1, problem
by ikegami (Patriarch) on Oct 28, 2004 at 15:03 UTC
    Your if will only work if !~ is changed to =~.