Hello ,
I have an issue of running a perl script in shell. Basically, im very new to programming. So, i dont understand how to pass an argument. The program basically reads a file which has to be invoked in Shell.

perl pgm.pl  reg1.pdb

So, in the above line, pgm.pl is invoked in Shell and it reads the file called reg1.pdb.

Can anybody plz explain how this can be done.

Here is one way to read and print the first record from a file whose name has been passed as an argument from the command line or shell that invokes the Perl program.

#!/usr/bin/perl -w
use strict;
my $filename = shift @ARGV; #Returns the value of the first parameter and removes it from @ARGV
open FILE, $filename or die "Could not read from $filename, program halting.";
# read the record, and chomp off the newline
chomp(my $record = <FILE>);
close FILE;
print "\n$record\n";