Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!caen!uwm.edu!spool.mu.edu!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.lang.perl Subject: Re: split ( positional ) Keywords: split Message-ID: <120789@uunet.UU.NET> Date: 1 Feb 91 07:57:30 GMT References: <1991Feb1.052629.16672@mlb.semi.harris.com> Organization: UUNET Communications Services, Falls Church, VA Lines: 34 In article <1991Feb1.052629.16672@mlb.semi.harris.com> jdr@sloth.mlb.semi.harris.com (Jim Ray) writes: >Probably sounds like a dumb question; but, is there any way to use >split given positional rather than string separators ( like -- >split at cols 6 19 37 etc ). Yes, there is, except you have to call it unpack. perl -de 0 DB<1> $qaz='one+two+three+four' DB<2> @wsx=unpack(A3xA3xA5xA4,$qaz) DB<3> p "@wsx" one two three four DB<4> p $wsx[2] three DB<5> p $#wsx 3 DB<6> q You can also use substring. And m// followed by $digit. The following produces the same @wsx from $qaz: $qaz =~ m/(...).(...).(.....).(....)/; @wsx = ($1, $2, $3, $4); "There's more than one way to do it." die "old age\n" if $^T > (60*60*24*365*70); # more or less -- Root Boy Jim Cottrell Close the gap of the dark year in between