Up until recently the data files always contained departures in time order, starting with the earliest in the day, so my manipulation always resulted in data which happened to be in time order. Just recently a few of them have contained data in which the departures are listed in any old order...
Hi again Feherke,
Mmmm. I suspect my use of your code got more elaborate than I remembered. Here's a couple of actual bits of data I am printing out (the full file has about 20 such entries):
$VAR1 = [
{
'JourneyCode' => 'JC1402'...
Last year feherke kindly helped me resolve a problem with printing a complex data structure. I have found the resultant script enormously helpful since then. An influx of work since the corona lockdown has left me with a need to slightly modify the print routine. I have received a number of data...
Good morning feherke, to overcome the ordering/bless issues I have changed the construction of my data structure to use an array, so I now have this:
$VAR1 = {
'DepartureTime' => '05:53:00',
'PrivateCode' => '4483928',
'VehicleJourneyTimingLinkRefOrder' => [...
Hi feherke, your script runs fine. My code doesn't [mad] :
tie %hash, 'Tie::IxHash';
tie %VehicleJourneyTimingLinkRef, 'Tie::IxHash';
foreach my $VehicleJourneys ($dom->findnodes('//VehicleJourneys/VehicleJourney')) {
#create hash
$PrivateCode=$VehicleJourneys->findvalue('./PrivateCode')...
I should have added that the order of the records in %hash is correct at that point because I used Tie::IxHash to maintain the order. I tried the same for %VehicleJourneyTimingLinkRef but that did not work for some reason.
Hi feherke, I have discovered that I need to print out the VehicleJourneyTimingLinkRef's in a specific order. For the 2 records I showed above, they have to be printed out in the order shown in VehicleJourneyTimingLinkRefOrder below:
$VAR1 = {
'PrivateCode' => '4483928'...
Given this data structure, can anyone help me print it out in the format shown below?
$VAR1 = {
'DepartureTime' => '05:53:00',
'PrivateCode' => '4483928',
'VehicleJourneyTimingLinkRef' => {
'7' => 'PT1M16S'...
Hi Ferherke, good to see that you are still around! Thanks for pointing that out. I've got thousands of these lines, to the point that I've just about gone word blind and I had not spotted the missing keys (despite the warning). I will take a look at the original xml and see what is going on...
After a long time away from perl I have found myself in a new job where I need to use it again (to manipulate lots of xml files). Hello again!
My problem: After some data extraction with XML::LibXML I am getting long strings of text returned, like this:
4541 PT1M27S 4542 PT1M51S 4543 PT2M16S...
It's been a while but I'm hoping one of you helpful guys can help me out again.
I'm trying to debug a 3000 line script written by a.n.other. When run it is throwing up dozens of warnings like this one:
Use of uninitialized value in string ne at ./ccrscript line 1528
The section of the script...
Shortly after sitting through 'The Jungle Book' video with my 3 year old nephew I heard him singing "those bear necessities, forget about your worries and your stripes".
Can anyone tell me why this gmake makefile works:
LIST1 := `ls`
# inside a rule: first line starts with a TAB, all the rest are spaces
all:
@for x in `ls`; do echo $$x ; done
outputs:
check.txt
inc.mk
makefile
subdir
but when I try to replace the 'ls' command with the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.