#!/usr/bin/perl -w # kleines quick & dirty script zum Anzeigen von BYTES aus # der Standardeingabe als Lochstreifen auf der Konsole # (Standardausgabe) # automatische Umwandlung von ASCII => Bytes o.ä. wird # nicht vorgenommen - das Script verhält sich damit wie # der Lochkartenpuncher # while() { # pro Zeile... foreach($cpos=0; $cpos < length; $cpos++) { $char = substr($_, $cpos, 1); $char = ord($char); #printf "Byte: %b\n", $char; print '|'; $against = 0x01; # binär 0000 0001 for($pos=0; $pos < 8; $pos++) { print '.' if($pos == 3); # Lochführung an pos. 3 $check = $char; $check = ($check >> $pos); if(($check & $against) == 0) { print ' '; # bit nicht gesetzt } else { print '*'; # bit gesetzt } } print "|\n"; } # for } # while exit 0; # fehlerlos enden.