CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Parsing: Edit Log



kapab07
Novice

Mar 26, 2013, 3:02 PM


Views: 778
Parsing

Hi,
Can someone tell me what I am doing wrong here.
I writing a small script to read and output all the N1 and its coordinates from my pdb file. The script below yields no output. What is wrong with it?
Here is the script:

#!/usr/bin/perl

open(FILE,$ARGV[0]);

$file = <FILE>;

foreach my $l ($file){

if ($l=~/^ATOM/ && $atname=~/N1/){
my $atname = substr($l, 66, 1);
my $X = substr($l, 27, 6);
my $Y = substr($l, 33, 6);
my $Z = substr($l, 42, 6);
}
}
print ($atname, $X, $Y, $Z);

exit;

When I run it it gives no output.


(This post was edited by kapab07 on Mar 26, 2013, 3:16 PM)


Edit Log:
Post edited by kapab07 (Novice) on Mar 26, 2013, 3:16 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives