in reply to Re^2: syntax error at labmonkey.pl line 1, at EOF
in thread syntax error at labmonkey.pl line 1, at EOF

Eeww. Consider getting a real code editor (or learn a *NIX standard such as vim or emacs). XCode's builtin editor also would be a step up (presuming you have the OS X development tools installed).

And as a comment to your original program, you might consider using the OS' units program which already has a fairly good knowledge of conversions rather than reinventing the wheel piecemeal yourself.

$ units kilograms grams * 1000 / 0.001 $ units feet kilometers * 0.0003048 / 3280.8399

(Those two lines are what you multiply the later by to get the former and what you divide the former by to get the later)

Update: Duuur. Strike that, reverse it; as is noted below. Been so long since I've used it I forgot how it works. (At least I remembered it was there . . . :)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^4: syntax error at labmonkey.pl line 1, at EOF
by Tanktalus (Canon) on Mar 04, 2008 at 20:31 UTC

    Your parenthetical statement is backwards, methinks. ;-)

    If you have 1 kilogram, you "* 1000" to get grams. Similarly, you can "/ 0.001" to get grams (same as "* 1000")

    The exact nature of the two outputs is a bit convoluted - the man page goes in to a LOT more detail.