Hello I have a code that uses the __DATA__ perl function to save the date below the code, I need to switch that to use data from a variable, but it goes into infinite loop does anyone knows to can I get around this?
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
here is the code:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
while( <DATA> ){
(@date,@start,@end,$employee);
(@date[0..2],@start[0,1],@end[0,1],$employee)=(split/\|/)[0..2,3..4,6..7,10];
push @{$schedule{$employee}},["@date",$start[0]*60+$start[1],$end[0]*60+$end[1]];
}
__DATA__
2007|3|21|12|00||14|00||FT|employee4
2007|3|21|12|00||14|00||KT|employee8
2007|3|21|14|00||16|00||DV|employee3
2007|3|21|14|00||16|00||AC|employee1
2007|3|21|16|00||18|00||VS|employee4
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I tried:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$var_records = qq~
2007|3|21|12|00||14|00||FT|employee4
2007|3|21|12|00||14|00||KT|employee8
2007|3|21|14|00||16|00||DV|employee3
2007|3|21|14|00||16|00||AC|employee1
2007|3|21|16|00||18|00||VS|employee4
~
while($var_records){
(@date,@start,@end,$employee);
(@date[0..2],@start[0,1],@end[0,1],$employee)=(split/\|/)[0..2,3..4,6..7,10];
push @{$schedule{$employee}},["@date",$start[0]*60+$start[1],$end[0]*60+$end[1]];
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thanks
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
here is the code:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
while( <DATA> ){
(@date,@start,@end,$employee);
(@date[0..2],@start[0,1],@end[0,1],$employee)=(split/\|/)[0..2,3..4,6..7,10];
push @{$schedule{$employee}},["@date",$start[0]*60+$start[1],$end[0]*60+$end[1]];
}
__DATA__
2007|3|21|12|00||14|00||FT|employee4
2007|3|21|12|00||14|00||KT|employee8
2007|3|21|14|00||16|00||DV|employee3
2007|3|21|14|00||16|00||AC|employee1
2007|3|21|16|00||18|00||VS|employee4
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I tried:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$var_records = qq~
2007|3|21|12|00||14|00||FT|employee4
2007|3|21|12|00||14|00||KT|employee8
2007|3|21|14|00||16|00||DV|employee3
2007|3|21|14|00||16|00||AC|employee1
2007|3|21|16|00||18|00||VS|employee4
~
while($var_records){
(@date,@start,@end,$employee);
(@date[0..2],@start[0,1],@end[0,1],$employee)=(split/\|/)[0..2,3..4,6..7,10];
push @{$schedule{$employee}},["@date",$start[0]*60+$start[1],$end[0]*60+$end[1]];
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thanks