in reply to Re: Multi-Word Anagrams
in thread Multi-Word Anagrams

I had the same problem as A.M. above, but changing @{ +shift } to @{ shift @_ } in ln. 99 (last line of expand subroutine) does the trick (@_ is necessary b/c @{ shift } is interpreted as @shift). ;)

Replies are listed 'Best First'.
Re: Re: Re: Multi-Word Anagrams
by japhy (Canon) on Oct 29, 2003 at 20:33 UTC
    That's odd. @{ +shift } should be the same as @{ shift(@_) }. What version of Perl mistook it for @shift?

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

      well, the arry deref wasn't working so I removed the plus sign just to see if it would do anything. That code - @{ shift } - was mistaken to be @shift. Adding the explicit argument list seemed to work. This is under WinMe, perl 5.8.0. I haven't tried it on Linux yet (frankly, I can't see how this would make a difference but, *shrug* you never know). What did you test on? B/c it seems to work for 2 people and not work for 2...
        I wrote it for Perl 5.005_03 (still on one machine I use), and added 'warnings'. I'll try it on my 5.8.0 on Linux... and it works just fine.

        _____________________________________________________
        Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
        s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        Unfortunately this isn't correct - I'm using perl 5.6.0 (Darwin) and the code doesn't work although I made the suggested change. Rather strange.