use CAM::PDF; my $filename = $ARGV[0]; #get the filename from the user my $pdf=PDF->new("$filename"); my $self = CAM::PDF->new("$filename"); #total no of pages my $pages = $self->numPages(); print "\n\nTotal number of pages: $pages\n\n"; untested: