S
Sandman
I am doing a tv listing kind of thing, and parsing a string that looks
something like this:
"12.00 Simpsons 12.30 Fresh prince 14.00 Superbowl"
Some of you might remember me asking for how to split that on the time yet keep
the delimiter. That worked out just fine. I am doing something like this now:
----
#!/usr/bin/perl
use strict;
use warnings;
my $string = "12.00 Simpsons 12.30 Fresh prince 14.00 Superbowl";
my @list = split / ?(?=\d\d\.\d\d)/, $string;
foreach (@list){
print "$_\n";
}
__END__
12.00 Simpsons
12.30 Fresh prince
14.00 Superbowl
----
Now, I realised that I wanted to display how long Simpsons would be on, so that
I would display "12.00-12.30 Simpsons".
Is there a way to do this without saving the individual starttimes and iterate
the data again, this time fetching the data from the saved times?
Basically, I would want to know, in iteration 1 what the delimiter was between
array item 1 and 2. I'm sure you understand what I am trying to do.
Thanks in advance!
something like this:
"12.00 Simpsons 12.30 Fresh prince 14.00 Superbowl"
Some of you might remember me asking for how to split that on the time yet keep
the delimiter. That worked out just fine. I am doing something like this now:
----
#!/usr/bin/perl
use strict;
use warnings;
my $string = "12.00 Simpsons 12.30 Fresh prince 14.00 Superbowl";
my @list = split / ?(?=\d\d\.\d\d)/, $string;
foreach (@list){
print "$_\n";
}
__END__
12.00 Simpsons
12.30 Fresh prince
14.00 Superbowl
----
Now, I realised that I wanted to display how long Simpsons would be on, so that
I would display "12.00-12.30 Simpsons".
Is there a way to do this without saving the individual starttimes and iterate
the data again, this time fetching the data from the saved times?
Basically, I would want to know, in iteration 1 what the delimiter was between
array item 1 and 2. I'm sure you understand what I am trying to do.
Thanks in advance!