in reply to Calculate dynamic password by complement to 9
I would also encourage you to read the relevant manpages. http://learn.perl.org/ is also a good resource. Assuming you just want a quick fix, this might do the trick:
$out = ##-- concatenate result digits join('', ##-- reverse digit order within each octet map {reverse split(//,$_)} ##-- reverse octet order reverse ##-- subtract octet values from 999 map {999-$_} ##-- extract final 3 octets ($ip =~ /^\d+\.(\d+)\.(\d+).(\d+)$/) );
|
|---|