Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: unpack and endianness Message-ID: <9847@jpl-devvax.JPL.NASA.GOV> Date: 7 Oct 90 03:09:54 GMT References: <9821@jpl-devvax.JPL.NASA.GOV> <885@usage.csd.unsw.oz.au> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Distribution: comp Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 18 In article <885@usage.csd.unsw.oz.au> cameron@spectrum.cs.unsw.oz.au (Cameron Simpson) writes: : From article <9821@jpl-devvax.JPL.NASA.GOV>, by lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall): : | sub swab { : | $_[0] =~ s/([\0-\377])([\0-\377])/$2$1/g; : | } : [...] : : Um, why can't I write : sub swab { : $_[0] =~ s/(.)(.)/$2$1/g; : } Because . doesn't match \n. [\0-\377] is the most efficient way to match everything currently. Maybe \e should match everything. And \E would of course match nothing. :-) Larry