Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!ogicse!intelhf!agora!markb From: markb@agora.uucp (Mark Biggar) Newsgroups: comp.lang.perl Subject: Re: Possible problem with syscall() Message-ID: <1990Dec1.185101.6489@agora.uucp> Date: 1 Dec 90 18:51:01 GMT References: <1454@tharr.UUCP> <10543@jpl-devvax.JPL.NASA.GOV> Organization: Open Communications Forum Lines: 19 In article <10543@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: >In article <1454@tharr.UUCP> gustav@tharr.UUCP (Paul Moore) writes: >: There appears to be a problem with syscall() in perl. When perl is working >: out whether an argument is a string or an integer, it decides by working out >: whether the argument looks like a number. But what about the *string* "1"? > >No, it doesn't decide by whether it looks like a number, exactly. It decides >by whether the value has ever been evaluated in a numeric context. The >literal string "1" has never been evaluated in a numeric context, so >should be treated as a string. If you have a string value of "1" in a >variable, but have evaluated it as a number (such as by comparing it using ==), >then it will be treated as a number. Note: you can force the variable $x to be a string for syscall by passing $x.'' as the argument, $x+0 can be used to force it to be a number. -- Perl's maternal uncle Mark Biggar Brought to you by Super Global Mega Corp .com