#!/usr/bin/perl use strict; use warnings; use Term::ANSIColor qw(:constants); open(my $in, "<-") or die "Cannot open stdin.\n"; my $height = "5'6.5\""; print " ", YELLOW, "Enter height ", GREEN, "[$height] ", RESET; my $input_height = <$in>; if ($input_height ne "\n") { $height = $input_height; } my @feet_inches = split('\'', $height); my $feet = $feet_inches[0]; my $inches_str = $feet_inches[1]; my $inches = substr $inches_str, 0, (length $inches_str) - 2; my $units_str = "$feet feet + $inches inches"; system("echo ' '`units --compact -1 '$units_str' cm` cm"); exit 0;