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: Advanced: Re: [cuboidgraphix] Script to remove features of a subscriber line.: Edit Log



cuboidgraphix
User

Jan 8, 2009, 10:56 AM


Views: 5682
Re: [cuboidgraphix] Script to remove features of a subscriber line.

This is what I have so far for the new 'similar' script. I tried incorporating memory as a variable.. but it doesn't work with the while loop.



Code
#!/usr/bin/perl 
use strict;
use warnings;
use Net::Telnet;

my $user="user";
my $pass="pass";
my $server="host";
my $t = Net::Telnet->new($server);
$t->waitfor('/Enter User Name/');
$t->print("$user");
$t->waitfor('/Enter Password/');
$t->print("$pass");

open(LIST,"list.txt")
or die "Can't open text file!";
while(my $number = <LIST>){
if($number =~ /^6/){
$t->waitfor('/>/');
$t->print("qhlr $number");
print "The number is:", $number, "\n";
$t->waitfor('/>/');
$t->print("");
(my $output) = $t->waitfor('/>/');

open(MEMORY, '>', \my $var)
or die "Can't open memory file: $!";
print MEMORY $output;
print "The output is:", $output, "\n";
while(my $line = <MEMORY>){
$line =~ s/\n//g;
print MEMORY $line;
if($line =~ /CSO:|QOSPI:/){
print "The number has Data Service.\n";
open(WRITE,">>data_numbers.txt");
print WRITE $number;
close(WRITE);
$t->print("N");
} else{
print "The number does NOT have Data Service.\n";
}
}
close(MEMORY);

print "----------------------------\n";
}
}

$t->print("quit all;logout");
print "The Session has Ended!\n";
$t->close;


The Open(LIST) is a text file that has thousands of lines, each line is a phone number.

The Open(WRITE) is a text file where I want to save all that numbers that DO have the data service.

the script times out at line 29. What am I doing wrong here? Am I using too many operations in the Open(MEMORY)?

Please help.


(This post was edited by cuboidgraphix on Jan 8, 2009, 11:00 AM)


Edit Log:
Post edited by cuboidgraphix (User) on Jan 8, 2009, 11:00 AM
Post edited by cuboidgraphix (User) on Jan 8, 2009, 11:00 AM


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

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