Sorry about the last one. I wrote some test & somehow it flipped away!

The following script meant to calculate simple math drills, such as 5 *
9 or 4 + 3, written in one line. What I cannot comprehend is the lines
marked with ---. What do they do? Why is there a "0 < index..." 


Oh, it all makes sense now......... what are you going on about man?

> Hi,
>
>

$line = <STDIN>;
chomp $line;

$first_space = index($line , " ");
$a = substr($line, 0, $first_space);

$last_space = rindex($line , " ");
$b = substr($line, $last_space+1);


--- if (0 < index($line, "*")) {
    print $a * $b, "\n";
}
--- if (0 < index($line, "+")) {
    print $a + $b, "\n";
}


________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to