> From: Marek Stepanek [mailto:mstep@podiuminternational.org] I see two problems: > #!perl -w > print "Enter a temperature in Celsius (i.e. 32 F, 100F):\n"; > $celsius = <STDIN>; First, you store the user's input in $celsius > chop ($celsius); > if ($input =~ m/^([-+]?[0-9]+(\.[0-9]*)?)\s*([CF]?)$/i) Then, you search the value in $input to see what's in it. You probably want to store the initial value in $input, not $celsius. Second, when I look at your data: > Enter a temperature in Celsius (i.e. 32 F, 100F): > + 34 C I suspect you will run into a second problem. The regular expression expects to see a string that starts with: ^ (and is to be remembered as $1): ( (optionally) a sign: [-+]? followed by one or more digits: [0-9]+ optionally followed by a decimal point, and zero or more digits (which will be remembered as $2): (\.[0-9]*)? followed by zero or more spaces: \s* optionally followed by a 'C' or and 'F' (which will be remembered as $3): ([CF]?) followed by nothing (end of string): $ The i means that this is case insensitive, so the 'C' could be 'c' and the 'F' could be 'f' This does not allow for a space between the optional sign and the first digit. To accommodate that, use this instead: if ($input =~ m/^([-+]?\s*[0-9]+(\.[0-9]*)?)\s*([CF]?)$/i) Hope this helps. Heck, since I ran this all through my mental parser, not through Perl itself, hope it's right! R David Francis rdf@hyperactiveinc.com http://www.hyperactiveinc.com # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org