Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 13th, 2012, 08:32 AM
andreas.london andreas.london is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 64 andreas.london User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 21 h 6 m 55 sec
Reputation Power: 1
Problem when printing

hi, i have a problem when i try to print all the variables in the same line. I chomped all the variables but still im getting my variables in different lines.

here is my script:
Code:
print MYFILE "$AEND,$VLAN,$EPTN,$VC,UP,$DESCRIPTION,UP\n";


and here is the result:
Code:
Gi2/0/9.2503,2503
,89.200.128.95,958401,UP,Etherstream Kingsmead
,UP



and even i print the result on the screen im getting this
Code:
,89.200.128.95,958401,UP,Etherstream Kingsmead,UP


any idea?

thanks!

Reply With Quote
  #2  
Old September 13th, 2012, 12:42 PM
Laurent_R Laurent_R is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2012
Posts: 507 Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level)Laurent_R User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 4 Days 19 h 10 m 16 sec
Reputation Power: 385
One possible explanation.

Sometimes, chomp does not remove the full carriage return. For example, if your file comes from a Windows box and your program runs on Unix or Linux, you may have this type of problem: perl "knows" it is running on Unix et, therefore, that the new line character is \n. But if your file comes from Windows, the new line is a combination of 2 characters, \r and \n. The chomp function removes \n but leaves the trailing \r.

There might be similar trouble between Mac and Windows, or Mac and Unix.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Problem when printing

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap