Hi,
I have the following code:
print PC "$id|"; foreach $userdirective(@userdirectiveslist){ $hashref=$instdetails{$instnum}{$userdirective}; foreach $key(keys %$hashref){ print PC "$key"; ## last key value } print PC ','; }
which prints:
smpd300:/jr/patrol/ba/data/BA_AUDIT# cat smpd300_patrol.apache_misc.da +t smpd300_1|On, smpd300_2|On, smpd300_3|On, smpd300_4|On, ,mpd300_5|On smpd300_6|On, smpd300_7|Off,
It should print "smpd300_5|On," but for some reason the comma is appearing at the start of the line.
What's even more strange is, if I do a grep:
smpd300:/jr/patrol/ba/data/BA_AUDIT# grep smpd300_5 smpd300_patrol.apa +che_misc.dat ,mpd300_5|On smpd300:/jr/patrol/ba/data/BA_AUDIT#
it seems to filter out the line.
Does anyone know why this happens, and how to fix it?
Thanks,
js.
Found the problem. There seems to be a carriage return in there:
od -c smpd300_patrol.apache_misc.dat 0000000 s m p d 3 0 0 _ 1 | O n , \n s +m 0000020 p d 3 0 0 _ 2 | O n , \n s m p +d 0000040 3 0 0 _ 3 | O n , \n s m p d 3 +0 0000060 0 _ 4 | O n , \n s m p d 3 0 0 +_ 0000100 5 | O n \r , \n s m p d 3 0 0 _ +6 0000120 | O n , \n s m p d 3 0 0 _ 7 | +O 0000140 f f , \n 0000144
In reply to print problem by js1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |