in reply to Re^12: Perl vs C
in thread Perl vs C

Well,
@xyz = ( 'a', 'b', 'c' ); print scalar (@xyz); #prints 3
is what I would have expected, the number of things in @xyz.
print(scalar( ( 'a', 'b', 'c' ) )); # c
Is different that I would have expected.
I will have to think more about how this occurs!
But I will say that compared with scalar(@xyz) which happens very often, this is rare albeit interesting.

Replies are listed 'Best First'.
Re^14: Perl vs C
by ikegami (Patriarch) on Mar 16, 2009 at 17:21 UTC
      Thanks! Great tips!

      I would say that after a quick glance, glob() is a very bad idea. I've been in "glob hell" a few times and this is a very bad place to be! Even amongst *NIX platforms there are variances and when I started doing code for WinX platforms, this became even nastier! I don't if there is a FAQ about this, but the portable way is to open a dir, read it, use grep to get what you want. Glob() is easy, but not portable.

        Glob() is easy, but not portable.
        So what? Just refrain from it if portability is an issue. It may surprise you, but large volumes of code are written where portability isn't an issue at all.