4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 What am I doing wrong here with my perl?
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
ijared
Junior WebHelper
Junior WebHelper


Joined: 07 Jun 2006
Posts: 1

PostPosted: Wed Jun 07, 2006 8:00 am (11 years, 6 months ago) Reply with QuoteBack to Top

I want the line begining with the code s$ be printed ot. Just that line. If I do it the way shown below, it only prints the first line. What am I doing wrong? Somebody help me here!

#!/usr/local/bin/perl

print "Enter the input filename: ";
chomp ($filename = <STDIN>);
s$=1234;
open INPUT, "<$filename" or die "Can't open input file: $!\n";

while ($line = <INPUT>) {
chomp $line;
$accession = substr($line, 0, 4);
if ($password = $accession){
print $line;
exit;
}
print "$accession\n";
}
close INPUT;
OfflineView User's ProfileFind all posts by ijaredSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.073589 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme