[TriLUG] rusty perl question

Owen Berry oberry at trilug.org
Wed May 9 12:19:19 EDT 2007


Or, if you need the exact number of equal signs matched:

if ( $line =~ m/^={14}$/ )
{
    # trigger code
}

-- or --

if ( $line eq "==============" )
{
    # trigger code
}

Owen

On Wed, May 09, 2007 at 12:01:18PM -0400, William Sutton wrote:
> do_this() if $line =~ m/^=+$/;
> 
> -or-
> 
> if ($line =~ m/^=+$/)
> {
>     # do stuff
> }
> 
> -- 
> William Sutton
> 
> 
> On Wed, 9 May 2007, Greg Brown wrote:
> 
> > I'd like to match this line as a trigger:
> > 
> > ==============
> > 
> > that is all that is on the line.
> > 
> > I'm so rusty even this basic pattern match is thwarting me.  I'm embarrased
> > to ask but what is the syntax for:
> > 
> > if $line equals that line I listed above {
> > 
> >                do this and that;
> > 
> > }
> > 
> > :(
> > 
> -- 
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> 



More information about the TriLUG mailing list