SPUG: looking for $variable for multiline print
Tim Maher
tim at consultix-inc.com
Tue Feb 5 12:56:23 CST 2002
On Tue, Feb 05, 2002 at 08:51:31AM -0800, Bob Brockhausen wrote:
> Does anyone know which $var to set to print
> out more than one line when matching?? I can't
There ain't no such thing! 8-}
> remember nor find it in Camel book...
> I tried to
if (/being_pat/ .. /end_pat/) { print "$_\n"}
I think you want:
$context="";
if (/begin_pat/ .. /end_pat/) { $context .= "$_\n" }
print $context;
The only variable that I can think of that's relevant is the one
allowing you to read/match/print entire paragraphs at a time: $/="".
But that's appropriate for printing entire paragraphs that contain a
match, not for printing all lines within a range of matching patterns,
as you've shown above.
> but this print each line seperatly, I want to handle
> them as one single scalar not seperate scalars
> (as in above example)
>
> --- Hailing frequencies closed
> ----------------------------------------------------------------------------
> Bob Brockhausen Phone: 206-318-6413
> PO Box 34067 S-IT2 Pager: 206-810-3707
> Seattle Wash 98124-1067 Fax: 206-318-2371
--
*==============================================================================*
| Dr. Tim Maher, CEO, Consultix (206) 781-UNIX/8649; ask for FAX# |
| tim at consultix-inc.com www.consultix-inc.com www.softwareprofessor.com |
| FEB: Perl; APR: Shell; Int. & OO Perl; Perl DataBase; JUNE: Basic UNIX, Perl |
*------------------------------------------------------------------------------*
| NEW Seminar Series! "DAMIAN CONWAY's Adv. Perl Workshop"; Seattle, 7/15-18 |
| Adv. OOP * Adv. Module Implementation Techniques * Programming in Perl 6 |
*==============================================================================*
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list