From d2e9320e3ab2e4028557a42a3bddca31b89c22e1 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Mon, 6 Feb 2012 19:21:47 +0100 Subject: [PATCH 1/1] fix comment skipping in pbm --- pbm2ZPL.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pbm2ZPL.pl b/pbm2ZPL.pl index 5c095af..967969b 100755 --- a/pbm2ZPL.pl +++ b/pbm2ZPL.pl @@ -13,8 +13,9 @@ my $pnm_file = shift @ARGV || die "usage: $0 print.pnm"; open(my $fh, '<', $pnm_file); my $p4 = <$fh>; chomp $p4; die "no P4 header in [$p4] from $pnm_file" unless $p4 eq 'P4'; -my $size = <$fh>; chomp $size; -my $size = <$fh>; chomp $size if $size =~ m/^#/; +my $size = <$fh>; +while ( $size =~ m/^#/ ) { $size = <$fh> }; # skip comments +chomp $size; my ( $w, $h ) = split(/ /,$size,$2); warn "WARNING: width of $pnm_file not 832 but $w !\n" if $w != 832; local $/ = undef; -- 2.20.1