1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#! /usr/bin/perl -w my $descr = $ARGV[0]; open DESCR, "< $descr"; while (<DESCR>) { chomp; if (/^(\w+)\s*=\s*([\w\d\.\/-]+)\s*(\#.*)?$/) { my $name = $1; my $file = $2; my $out = `md5sum $file`; $out =~ /^([0-9a-f]+)\s/; my $hash = $1; print "$name = $hash\n"; } else { print "$_\n"; } } close DESCR;