View Single Post
  #3 (permalink)  
Old December 8th, 2006, 08:29 AM
crmpicco crmpicco is offline
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks for that bluemin, here's another solution that worked:
Code:
#! /usr/bin/perl

# Craig R Morton
# Count number of nodes in an XML document
# Last_Edit: 08-Dec-2006

use warnings;
use strict;
use XML::Simple; # you will need to have this installed on your machine

# read the xml document 'employees.xml' as the input
my $xml = XMLin('employees.xml');

# get the number of nodes called 'employee'
my $count = @{$xml->{employee}}; 

print "We have $count employees\n";

www.crmpicco.co.uk
www.ie7.com
Reply With Quote