Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: Using 'split' with multi character expressions Message-ID: <8203@jpl-devvax.JPL.NASA.GOV> Date: 25 May 90 18:45:38 GMT References: <1933@pyrltd.UUCP> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 23 In article <1933@pyrltd.UUCP> jimmy@pyrltd.UUCP (Jimmy Aitken) writes: : (Patchlevel 18, runiing under OSx4.4c on a Pyramid) : : I'm trying to read in a file, and split on a delimieter that seperates : different records. In the test case below, these are a line of 7 '-' : signs. I can split on a simple string, but I want to guard against : the case where the pattern could be included elsewhere. In the case : shown below, it works with the exception that record 2 line 3 is sent : into a speerate array element. : : I've tried all possible combinations of pattern matching that I can : think of to specify a unique pattern for split, but tnothing seems to : work as I expect it. I would expect that setting $artsep to : "^-------$" to do what I want, but it does not. Have I read the : manual wrong, and if so, can someone point me in the correct direction : please? Go ahead and use "^-------$" but set $* to enable multi-line pattern matching. Otherwise the ^ only matches on the beginning of the string because the pattern matcher is optimizing on the assumption that your string only contains one line. Larry