I have the following subroutine I am building:
Heres the problem. When I look at the output of the:
print ALI "@sub_tic_vars\n";
I see this:
And when I look at it in my editor with tabs, spaces etc. turned on, I see many spaces, tabs and even a character return in each element as you can see above.
When I look at the output of the:
#print LOG "$sub_tier\t$sub_sev_code\t$sub_type\n";
after the split, I see this:
I believe 415 is the size of the @sub_tic_vars array.
My split is not working, yet it looks fine to me. I have been having fits with splitting in this program. I have two questions.
1) will tabs spaces and carrage returns in array elements mess up a split or any other operation on that array.
2) if so, whats an easy way to get rid of them or make them not occur in the first place as the array is built from a flat file query like this (example of one):
Thanks in advance,
Nick
I got a Biz Degree! How the h*ll did I get here?
Code:
sub TicketTable
{ # Start of Ticket Table generation subroutine
##########################################################################################
#
# Read passed array references, de-reference them and scope subroutine variables
#
##########################################################################################
my $combin_ref = shift;
my $tic_vars_ref = shift;
my @sub_tic_vars = @$tic_vars_ref;
my @sub_combin = @$combin_ref;
##########################################################################################
open (ALI, ">C:\\stage\\temp\\sub_out.txt");
print ALI "@sub_tic_vars\n";
chomp @sub_tic_vars;
my ($sub_tier, $sub_sev_code, $sub_type, $sub_close_month, $sub_open_month, $sub_close_year, $sub_open_year, $sub_rpt_month, $sub_rpt_yr,$sub_res_anal_code) = split (/,/,@sub_tic_vars);
print LOG "$sub_tier\t$sub_sev_code\t$sub_type\n";
Heres the problem. When I look at the output of the:
print ALI "@sub_tic_vars\n";
I see this:
Code:
Tier 1, warning, system,12,12,2004,2004,02,2005,
Performance Management
Tier 1, warning, system,12,12,2004,2004,02,2005,
Performance Management
Tier 1, normal, system,12,12,2004,2004,02,2005,
Performance Management
Tier 1, warning, system,12,12,2004,2004,02,2005,
Customer Changes
Tier 1, normal, network,12,12,2004,2004,02,2005,
Reboot / Reset
Tier 1, critical, system,12,12,2004,2004,02,2005,
Customer Changes
And when I look at it in my editor with tabs, spaces etc. turned on, I see many spaces, tabs and even a character return in each element as you can see above.
When I look at the output of the:
#print LOG "$sub_tier\t$sub_sev_code\t$sub_type\n";
after the split, I see this:
Code:
415
415
415
415
415
415
415
415
415
415
I believe 415 is the size of the @sub_tic_vars array.
My split is not working, yet it looks fine to me. I have been having fits with splitting in this program. I have two questions.
1) will tabs spaces and carrage returns in array elements mess up a split or any other operation on that array.
2) if so, whats an easy way to get rid of them or make them not occur in the first place as the array is built from a flat file query like this (example of one):
Code:
KEY_CHAR,NAME,STARTPRGN,STOP
CM00000009762,ROUSE Closed,09-10-2003-16:26:54,09-10-2003-16:27:29
CM00000009762,ROUSE Complete,09-08-2003-16:04:10,09-10-2003-16:26:55
CM00000009762,ROUSE Desktop IMAC SLA,09-08-2003-14:43:29,09-10-2003-16:26:55
CM00000009762,ROUSE Open,09-08-2003-14:43:27,09-08-2003-14:43:53
CM00000009762,ROUSE Work in Progress,09-08-2003-14:43:53,09-08-2003-14:43:55
CM00000009762,ROUSE Work in Progress,09-08-2003-14:43:56,09-08-2003-14:44:43
CM00000009762,ROUSE Work in Progress,09-08-2003-14:44:44,09-08-2003-14:46:04
CM00000009762,ROUSE Work in Progress,09-08-2003-14:46:05,09-08-2003-16:03:00
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:01,09-08-2003-16:03:03
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:04,09-08-2003-16:03:08
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:09,09-08-2003-16:03:45
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:45,09-08-2003-16:03:47
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:48,09-08-2003-16:03:49
CM00000009762,ROUSE Work in Progress,09-08-2003-16:03:50,09-08-2003-16:04:10
CM00000009762,ROUSE Work in Progress,09-08-2003-14:43:49,09-08-2003-14:43:51
CM00000009762,ROUSE dispatch,09-08-2003-16:03:45,09-08-2003-16:03:47
CM00000009762,ROUSE dispatch,09-08-2003-16:03:48,09-08-2003-16:03:50
CM00000009762,ROUSE dispatch,09-08-2003-16:03:09,09-08-2003-16:03:45
CM00000009762,ROUSE dispatch Work in Progress,09-08-2003-16:03:45,09-08-2003-16:03:47
CM00000009762,ROUSE dispatch Work in Progress,09-08-2003-16:03:48,09-08-2003-16:03:50
CM00000009762,ROUSE dispatch Work in Progress,09-08-2003-16:03:09,09-08-2003-16:03:45
CM00000009762,ROUSE post impl review,09-08-2003-16:04:10,09-10-2003-16:26:53
Thanks in advance,
Nick
I got a Biz Degree! How the h*ll did I get here?