#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    68
    Rep Power
    3

    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!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    842
    Rep Power
    496
    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.

IMN logo majestic logo threadwatch logo seochat tools logo