Need help with Perl regex

From: surfking (bkimelman_at_JUNK.sympatico.ca)
Date: 01/07/05


Date: Thu, 6 Jan 2005 18:49:34 -0500


 

I found this line of code
which was parsing the /etc/termcap file located on a UNIX system.

if (/(^|\|)${term}[:\|]/) {

I used the code from which this line was extracted and it successfully
parsed/extracted the termcap entry for my particulat type of terminal.

I realize that the "^" character is used to anchor the pattern match to
the start of a buffer and that enclosing part of a pattern match within
a set of parenthesis enables you to retrieve the value of the matched
segment and that "|" is used as an "logical or" operator, but given the
format of entries in the /etc/termcap file, I don't see how this pattern
is successfull. Can anyone out there give me some ideas on this ?