on 6/2/99 7:44 AM, Chris Nandor wrote... >At 23.51 -0400 1999.06.01, Scott Prince wrote: >>$^O - I have a script and need to know if the platform is Mac or other: >> >>if ($^O =~ /mac/) { #.... } >># then later on... >>$z = eval {/$x/}; >># but wait, eval no longer works! >># removing the ($^O =~ /mac/) verified this. > >/mac/ won't match $^O on MacPerl. It might match some other OS's, like >machten. $^O for MacPerl is "MacOS". See perlport.pod (on >http://pudge.net/macperl/ and in perl5.004_05 and higher). Actually I believe I used a case insensitive match: if ($^O =~ /mac/i) laziness on my part, instead of checking what $^O returns for the mac, just matched on it. But how would that change eval? I should also have noted that both examples are saved as cgi's served up with Web Sharing. >>scalar - counting array elements: >> >>$_ = "a\tb\tc\t\t\t\n"; # read in from a database file >>@x = split (/\t/, $_); >>if (scalar (@x) == 6) { #... } >># for Unix the number of elements is 6 (as expected) >># for the Mac it is 3 >># MacPerl will not see the empty elements. > >I wonder what version you have? Using the 5.2.0r4 (the latest), I try: > > $_ = "a\tb\tc\t\t\t\n"; # read in from a database file > @x = split (/\t/, $_); > print scalar @x; > >It prints "6". Right you are. In this case the file is an uploaded file and it seems that it may be related to using cgi-lib.pl. Is CGI.pm a more compatible solution for this? I have been attempting to have one cgi script that will run on Mac or Unix by changing only one line in the script. Maybe that's asking too much, but I love my Mac and hate the Unix text editors. It would be nice to have one subroutine that would handle all the little quirks; flock, file sys delimiters, \r\n, etc. Scott ===== Want to unsubscribe from this list? ===== Send mail with body "unsubscribe" to macperl-request@macperl.org