Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!bu.edu!att!bellcore!uunet!ogicse!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: Take the mod of a variable? Message-ID: <1990Dec4.215840.10542@iwarp.intel.com> Date: 4 Dec 90 21:58:40 GMT References: <1990Dec03.160045.13310@cs.widener.edu> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 21 In-Reply-To: brendan@cs.widener.edu (Brendan Kehoe) In article <1990Dec03.160045.13310@cs.widener.edu>, brendan@cs (Brendan Kehoe) writes: | Is there any way to do something like $blah % 2 ($blah mod 2) ? I couldn't | find anything in TFM. Yeah, try $blah % 2. :-) $ perl -e '$blah = 15; print $blah % 2;' 1 It isn't really in the manpage. Basically, Perl expressions are defined in terms of C expressions, and since % is not in the category of "what C has that Perl doesn't"... Perl has it. It's clearer in The Book (I know... that doesn't help just yet). print "Just another Perl [book] hacker," -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/ Brought to you by Super Global Mega Corp .com