#!/usr/bin/perl use strict; use warnings; use GD::Barcode::Code39; MakeBar('0'); MakeBar('1'); sub MakeBar { my $txt = shift; my $oGdBar = GD::Barcode::Code39->new("*$txt*"); die $GD::Barcode::Code39::errStr unless($oGdBar); open(IMG, ">", "$txt.png") or die $!; binmode(IMG); print IMG $oGdBar->plot(NoText=>1, Height => 40)->png; close(IMG); }