Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal L. Schwartz) Newsgroups: comp.unix.questions Subject: Re: Perl question relating to pattern substitution Message-ID: <1991Jan5.182926.23252@iwarp.intel.com> Date: 5 Jan 91 18:29:26 GMT References: <1991Jan5.051035.7202@csn.org> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal L. Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 23 In-Reply-To: frechett@boulder.Colorado.EDU (-=Runaway Daemon=-) In article <1991Jan5.051035.7202@csn.org>, frechett@boulder (-=Runaway Daemon=-) writes: | @ This is the line that I am having problems with.. Simply, it replaces every | @ two characters with the string "pack(C,hex(\1.\2)" whis is totally useless | @ as it is supposed to be converting ascii to binary. | $file =~ s/(.)(.)/pack(C,hex(\1.\2))/eg; # convert ascii to bin | The problem is that my perl doesn't recognize pack as being a function | which is understandable as I can't find reference to pack in | TFM for ed, ex, sed, awk, perl, or C. Anyone know how I might be able to | work around this little bug and get this to work.. Remember, this works on | some machine somewhere... Any help would be appreciated. You have an old Perl (the "pack" function wasn't in earlier Perls). Say perl -v. If you don't get at least version 3.0, get yerself a brand-spankin'-new Perl. Version 3.0 patchlevel 41 is the latest, and can be fetched from most GNU places as well as devvax.jpl.nasa.com. Just another Perl 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'..."====/