This statement: if($line =~ /!bgs/){ is syntactically correct, but probably isn't doing what you want: it's checking to see whether $line contains the string "!bgs" somewhere, not the rather longer string defined by your here document. Presuming $bgs is just a string, and not a command to be executed you may want something more like this:
while(<SH>){ if(/$bgs/) {# Note $ means it's a variable, to be interpolated; ! +doesn't #do processing for true case } else{ #do processing for false case }
You really, really should study the documentation. I think Perl has quite clear, well organized documentation (it's not perfect, but then producing perfect documentation is at least as hard as producing perfect code); you're missing something. I also think you may be failing to tell us something. Your $bgs string looks a lot like a command, and if you want to capture its output, you'll have to use backticks.
emc
Information about American English usage here and here.
Floating point issues? Read this before posting: http://docs.sun.com/source/806-3568/ncg_goldberg.html
In reply to Re: I just want IF, OR, OR not every one
by swampyankee
in thread I just want IF, OR, OR not every one
by wcj75019
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |