my $max_records = ''; GetOptions("max_records=i" => \$max_records) or die ("Error in command line arguments\n"); my @results = My::App::Schema->schema->resultset('MyTable')->search( undef, { page => 1, rows => $max_records, } ); for my $result ( @results ) { ### Processing Domain ID: ($result->id) print $result."\n"; }