root/paper-tape-project/trunk/perl-tools/how-long-is-this-papertape

Revision 1, 0.5 kB (checked in by sven, 4 years ago)

Erstimport

Line 
1#!/usr/bin/perl
2#
3# kleines (Spaß)programm: Wie lang ist diese Datei als Lochstreifen?
4# Benutzung:
5#  ./programm.pl [datei1] [datei2] [datei3] [usw...]
6#
7
8my $total_l = 0; my $l;
9foreach (@ARGV) {
10    $l = (stat)[7];
11    print "$_: $l bytes = ".bytes2cm($l)." cm\n";
12    $total_l += $l;
13}
14print "total: $total_l bytes = ".bytes2cm($total_l)." cm\n"
15 unless($l eq $total_l); # nur ein Argument.
16
17sub bytes2cm {
18    my $bytes = shift;
19    # inch = $bytes/10;
20    # centimeter = inch / 2.54
21    my $cm = ($bytes / 10) * 2.54;
22}
Note: See TracBrowser for help on using the browser.
© 2008 - 2010 Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License