#!/usr/bin/perl -w ... use warnings; ... BEGIN { $^W = 1; } sub BEGIN { if ($^W == 1) {say "Let's get started..."} else {die $@} } #### my $resistance = ; if ($current =~ /mA/) { $current =~ s/mA//; $current =~ s/(^\s+| )//; $current /= 1000; } #### my $input = ; my ($current) = $input =~ /^\s*[\d.]+\s+/ or do { error_stuff(); ... # next, redo, or return, as appropriate }; $input =~ /\s+mA\s*$/ and $current /= 1000;