in reply to Re^2: using reference to subroutine
in thread using reference to subroutine

Several problems here. Use warnings and strict!
Your error is because you are calling 'sorter' on line 26 with only one argument - you are not passing it an '$iter'.
It is a bad idea to have a local variable and a global of the same name - very confusing ($iter).
The syntax for calling the ref should be &$iter($index)
I also spotted that your foreach loop is wrong, use $#lines for the highest index, @lines will go one element beyond the end of the array (it give s the number of elements).
Probably more errors lurking, but that should do for now.
update: $allSeq[&$iter()]= $allSeq[$index].$first;I really hate your use of globals in the subroutine, sorry, but it makes the code difficult to figure out. Should your $first and $second in sorter() overwrite the globals?

Replies are listed 'Best First'.
Re^4: using reference to subroutine
by blazar (Canon) on Apr 06, 2007 at 09:30 UTC
    The syntax for calling the ref should be &$iter($index)

    Well, also $iter->($index).

Re^4: using reference to subroutine
by kotoko (Novice) on Apr 05, 2007 at 17:00 UTC
    Thanks a lot!

    The strict module is really great! I'm not such a big fan of warnings, it makes the program crash and I have no idea why. but at this point I changed the code a lot so maybe the bug is noteven up there

    Also, how do I make simple paragraphs in these texts boxes? So far I only can up with the p tag but it does double paragraph :(

      The strict module is really great! I'm not such a big fan of warnings, it makes the program crash and I have no idea why.

      warnings can't make your program "crash". It will spit out, ehm... warnings. Generally this is good, because it is an indication that you may be doing something wrong, and you'd better take care of correcting that. OTOH in the rare situations in which you feel a particular warning is unjustified, you can still locally disable it.