I'll bet it has to do with the <<'s right after the var name How about this output :: print "--->>>>$line\<<<<---\n"; Or this print "--->>>> $line <<<<---\n"
You may try $line =~ s/\n|\r//g; Dan -----Original Message----- From: Jason Frisvold [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 1:54 PM To: Dan Muey Cc: Perl Beginners List Subject: RE: "hidden" characters in an input stream Output is as follows : (note: test.perl is just a small test program to do just the telnet and getline ... I don't really name my programs test.perl ... :) [friz@dhcp9-52 friz]$ ./test.perl | more ---- start line ---- sec log sho ---- end line ---- ---- start line ---- UserName Application Authentication Method Profile Name ---- end line ---- ---- start line ---- --------------------- ----------- --------------------- -------------------- ---- end line ---- ---- start line ---- myuser console password admin ---- end line ---- ---- start line ---- myuser http password admin ---- end line ---- ---- start line ---- myuser telnet password admin ---- end line ---- It appears that the line shows up correctly here which is why I think there's a CR somewhere... On Wed, 2003-01-08 at 14:42, Dan Muey wrote: > Perhaps that data contains '<<<<<' in it already? > > Try > print "--->>>>$line\<<<<---\n"; > Just in case it's seeing it as a varaible named 'line<..' That could > cause all sorts of screwy ness > > For kicks what does it ouput if you do : > > print "\n---- start line ---- \n $line \n---- end line ---- \n"; > > > Dan > > -----Original Message----- > From: Jason Frisvold [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 08, 2003 1:39 PM > To: Perl Beginners List > Subject: "hidden" characters in an input stream > > > Hi all, > > I'm using the Net::Telnet module to automate some of the more menial > tasks I have to deal with every so often. Part of the task requires > parsing a stream of data from the device I'm telnetting to (A Marconi > ASX-200 to be exact) ... I've successfully set up the telnet, logged > in, and executed the proper commands. Now, however, I need to > retrieve data from the device. I can submit the command and use > getline() to retrieve lines, one at a time, and parse it. However, > there are "hidden" characters here and I don't know how to determine > what they are. > > Here is a quick snippet of the code : > > $Telnet->print("sec log sho"); > while (my $line = $Telnet->getline(Timeout => 5,)) { > chomp $line; > print "--->>>>$line<<<<---\n"; > } > > This should simple print out each line with the arrows before and > after the line. However, upon output, I get something like the > following : > > --->>>> sec log sho<<<<--- > UserName Application Authentication Method Profile > Name<<<<--- > --------------------- ----------- --------------------- > --------------------<<<<--- > myuser console password admin<<<<--- > myuser http password admin<<<<--- > myuser telnet password admin<<<<--- > > > I'm guessing this is a carriage return character? I believe that's > the one that causes the output to start at the beginning of the line. > > Does anyone know how I can properly remove these characters so I can > parse this information? > > In addition, is using the timeout on getline the "proper" way to > determine that the input stream has stopped? > > Thanks, -- --------------------------- Jason H. Frisvold Backbone Engineer Penteledata Engineering [EMAIL PROTECTED] RedHat Certified - RHCE # 807302349405893 --------------------------- "Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]