in reply to Backticks and Pattern Matching.

If you had use strict;, you'd see that you were assigning (rather than tetsing) when you did if ( $spooler = "scheduler is not running" )

In any event, you should use eq when comparing strings. == is for testing numbers, = is for assignment.

Replies are listed 'Best First'.
Re^2: Backticks and Pattern Matching.
by misconfiguration (Sexton) on Feb 05, 2008 at 16:08 UTC
    my $spooler = `lpstat -r`; chomp($spooler); if ( $spooler eq "scheduler is not running" ) { system("lpsched"); }
    I've been using strict but the interpreter hadn't spit any messages out! I think you guys pretty much clarified my situation, thanks so much for the help you guys have provided!