Last active
August 29, 2015 14:06
-
-
Save shofel/c26475675d394c257c5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# convert millimeters to pixels | |
use feature 'say'; | |
# take params | |
my (@mm,$dpi,$px); | |
($dpi, @mm) = @ARGV; | |
die "usage: $0 dpi mm[ mm]\n" unless ($mm[0]*$dpi); | |
# give answer | |
say "dpi: $dpi"; | |
say "mm: @mm"; | |
say 'px: ', map {sprintf '%.2f ', $dpi / 25.4 * $_} @mm; | |
__END__ | |
./mm2px.pl 300 34 46 | |
dpi: 300 | |
mm: 34 46 | |
px: 401.57 543.31 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment