On Wednesday 15 Oct 2003 11:31 am, Gary Stainburn wrote: > Hi folks, > > I know this has been discussed recenty, and I've actually got it working > elsewhere, but the script I'm currently working on isn't working. > > I've got file /home/gary/bin/svcdetails.pm which contains: > > # Config file for import/export routines > > my %ctrl_accs=('111111'=>'VSC|S|Vehicle Cash Customers', > '111112'=>'VSW|S|Warranty Schedule', > '111113'=>'VHP|S|H.P Commissions', > '111114'=>'VLC|S|Licenses Surrendered', > '111117'=>'BRM|S|Standard Support', > '111119'=>'RIC|S|Ringways Inter Company', > '111118'=>'CHR|S|Car Hire', > '999997'=>'VRB|S|Vehicle Reg Bonuses'); > > followed by further variable definitions. Then, in my scripts I've got: > > #!/usr/bin/perl -w > use strict; > use warnings; > use DBI; > use lib '/home/gary/bin'; > use vars qw(%ctrl_accs %masters %accgroups %counties); > use svcdetails; > > foreach my $ac (keys %ctrl_accs) { > print "'$ac'=>'$ctrl_accs{$ac}'\n"; > } > > but when I run the script, nothing comes out. > > As I said, I've got another script on an identical system which does work > in this way and has worked for some time. I've checked the syntax on both > and they're identical apart from the actual variable names. > > Anyone see what I've missed?
Okay folks, I've seen what I've missed - that fact that I'm a muppet. The variables in this case have been 'my'd, which presumably has scoped them to this file, whereas on the previous - working - project I didn't use 'my'. Gary -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]