the perl script is meant to do something as described below
I have a file , i then split the lines ( in the file) into arrays so that I can
use a value from that line which then prints out a statement
when a particular number appears on a line, but my script seems to be
prinintg out all the statements for everyline,
see below
#!/perl/bin
open (In,"tascomod.log") or die ("can not open file at the moment");
open (Out, "tasmodtypfinrpt.txt") or die ("cannot open output file may
+be you should create one");
#print Out " TXSpeed Rx Speed";
while ($line=) {
@temp = split(/[=]/,$line);
#if ($temp[1] >100)
# {
# print "Session id is $temp[1] with ";
# }
if ($temp[1]>=1&&($temp[1]<=45))
{
$modtyp = $temp[1];
print "\n$modtyp\n";
#the above line prints out ok but does not seem to then print out the
+statement which corresponds with the value instead
#it prints out all the statements, even the ones that do not correspon
+d to the value!
if ($modtyp = 20)
{
print "V34\n";
}
if ($modtype = 9)
{
print "no connection\n";
}
elsif ($modtype = 34)
{
print "V90\n";
}
}
}
the results looks like the following;
9
V34
no connection
34
V34
no connection
9
V34
no connection
45
V34
no connection
45
V34
no connection
7
V34
no connection
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.