#!/usr/bin/perl -w

use strict;
use Business::ISBN;

my $isbn = $ARGV[0];

## 10 digit ISBNs
#$isbn_object = Business::ISBN->new('1565922573');
#$isbn_object = Business::ISBN->new('1-56592-257-3');
#
## 13 digit ISBNs
#$isbn_object = Business::ISBN->new('978-0-596-52724-2');

my $isbn_object = Business::ISBN->new($isbn);

# convert
my $isbn10 = $isbn_object->as_isbn10;    # for the 978 prefixes
print $isbn10->type, ": ", $isbn10->as_string, "\n";

my $isbn13 = $isbn_object->as_isbn13;
print $isbn13->type, ": ", $isbn13->as_string, "\n";


#print the ISBN with hyphens at usual positions 
print $isbn_object->type, ": ", $isbn_object->as_string, "\n";

#print the ISBN with hyphens at specified positions.
#this not does affect the default positions
print $isbn_object->type, ": ", $isbn_object->as_string([]), "\n";


exit 0;
