home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!malgudi.oar.net!uoft02.utoledo.edu!jupiter!steiner
- Newsgroups: comp.lang.perl
- Subject: questions
- Message-ID: <1992Aug22.163911.9640@uoft02.utoledo.edu>
- From: steiner@jupiter.cse.utoledo.edu (jason "Think!" steiner)
- Date: 22 Aug 92 16:39:10 EST
- Nntp-Posting-Host: jupiter.cse.utoledo.edu
- Lines: 34
-
- i discovered pearl last week, printed out the man pages & have been
- experimenting a bit. it's a great language, but being such a newbie
- i tend to make some mistakes/assumptions that i should be able to
- avoid...
-
- here's one of many questions:
-
- i have a search line like
-
- $line =~ /^(.{0,$limit}[${spacechars}])(.*)$/;
-
- which grabs as many words as can fit in $limit space + the next separator
- into $1 and puts the rest in $2. just in case there isn't a separator
- in the limit the next line is
-
- $line =~ /^(.{0,$limit})(.*)$/ unless $1;
-
- (just grab $limit characters, don't worry about separators.)
- this is assuming that the first match will set $1 to null or undefined
- if it doesn't get anything. can i do that? it seemed reasonable to
- me, but then the second case kept failing. i printed $1 between the
- two statements & it had the value of a $1 from earlier in the script.
- does match just ignore the $[1-9] values if they're not found?
-
- the script works now, (i clear $1 before doing the matches) i'm just kinda
- curious.
-
- jason, who can now hit * in vi and wordwrap everything while maintaining
- followup quotes and trimming attribution lines.
-
- --
- `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,
- `, "Get off the cross. We need the wood." steiner@jupiter.cse.utoledo.edu `,
- `,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,
-