source: projects/perl-tools/how-long-is-this-papertape @ 27

Last change on this file since 27 was 1, checked in by sven, 12 years ago

Erstimport

File size: 525 bytes
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 repository browser.
© 2008 - 2013 technikum29 • 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