Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!decwrl!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.lang.perl Subject: Re: $/ Message-ID: <1990Sep7.204137.26927@iwarp.intel.com> Date: 7 Sep 90 20:41:37 GMT References: <1990Sep7.170029.16710@uvaarpa.Virginia.EDU> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 28 In-Reply-To: frech@mwraaa.army.mil (Norman R. Frech CPLS) In article <1990Sep7.170029.16710@uvaarpa.Virginia.EDU>, frech@mwraaa (Norman R. Frech CPLS) writes: | I am working on a mailbox conversion routine and would like to use | ^A^A^A^A\n^A^A^A^A\n as $/, slurp the whole file and process each message | as $_. The problem is when I set $/ it only takes the first ^A as the | record seperator (this is what the manual also indicates should happen). | Is there a way to overide this convention and specify $/ to longer than | one character? As it says in the forthcoming book (somewhere :-), $/ takes only one character. To get a whole thing, try something like: @messages = split(/\001\001\001\n\001\001\001\n/, join("",)); for (@messages) { # $_ is now a single message } Note that this requires that you have at least twice the core as your largest expected mail message file (for a short period of time, anyway). If you don't, you're gonna have to eat a line at a time, and look for the split yourself. 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: "Welcome to Portland, Oregon, home of the California Raisins!"=/