On Mon, Mar 23, 2009 at 09:53, igotux igotux <igo...@gmail.com> wrote: > Hi Team, > > Can someone explain what is wrong happeneing here ? > > $ perl -e 'use Business::ISBN; $isbn_object = new > Business::ISBN('0-59610-206-2');print $isbn->as_string;' > Can't call method "as_string" on an undefined value at -e line 1. > $
Two reasons, first you are using single quotes inside of a single quoted string in the shell causing a problem in what gets passed to perl and second you are storing the object in $isbn_object and then trying to call the as_string method on $isbn. Try this: #!/usr/bin/perl use strict; use warnings; use Business::ISBN; my $data = "0-59610-206-2"; my $isbn = Business::ISBN->new($data); unless ($isbn->is_valid) { print "$data is not valid because ", $Business::ISBN::ERROR_TEXT{$isbn->error}, "\n"; } print $isbn->as_string, "\n"; -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/