Operating System - HP-UX
1753420 Members
4808 Online
108793 Solutions
New Discussion юеВ

Re: Perl says reserverd word "our" is deprecated

 
SOLVED
Go to solution
Darrell Allen
Honored Contributor

Perl says reserverd word "our" is deprecated

Hi all,

I'm trying to use Clay's fileage.pl script as posted in:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xe26442308663d611abdb0090277a778c,00.html

I'm using Perl 5.005_03 on HPUX 11.0 and get the following messages:

Use of reserved word "our" is deprecated at /usr/local/adm/fileage.pl line 72.
Global symbol "$opt_m" requires explicit package name at /usr/local/adm/fileage.pl line 72.
Global symbol "$opt_a" requires explicit package name at /usr/local/adm/fileage.pl line 72.
Global symbol "$opt_c" requires explicit package name at /usr/local/adm/fileage.pl line 72.
Global symbol "$opt_s" requires explicit package name at /usr/local/adm/fileage.pl line 72.
Global symbol "$opt_v" requires explicit package name at /usr/local/adm/fileage.pl line 72.
Execution of /usr/local/adm/fileage.pl aborted due to compilation errors.

Probably elementary to you, but Greek to me.

Thanks,
Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Perl says reserverd word "our" is deprecated

I don't have a Perl that old to try but I suspect that the 'shebang' should be changed so that it calls /opt/perl5/bin/perl. The better answer is to setup a symbolic link between /use/bin/perl and your latest perl. It wouldn't surprise me if the #!/usr/bin/perl doesn't cause you to run the really ancient Perl 4 via a symbolic link from /usr/contrib/bin/perl to /usr/bin/perl.


You really should upgrade to at least 5.6.x; you can download a binary version from:
http://hpux.connect.org.uk/hppd/hpux/Languages/perl-5.6.1/; it's just a swinstall and is very easy.

By the way, I have a leter version of that script which will output the age of a file in epoch seconds via the -e option.
Invoke it as fileage.pl w/o arguments to display usage.

If it ain't broke, I can fix that.
Ralph Grothe
Honored Contributor

Re: Perl says reserverd word "our" is deprecated

Hi Darrell,

as already pointed out your Perl version seems dated.
The "our" declaration for global variables was only introduced from Perl 5.6.0 onwards.
If you have to stick with your "old" Perl version then you could try to declare the globals with the "vars" pragma:

e.g.

use vars qw($opt_a $opt_c $opt_m $opt_s $opt_v);

Madness, thy name is system administration
Bill Hassell
Honored Contributor

Re: Perl says reserverd word "our" is deprecated

Or you can download Perl 5.6.1 from HP at the software.hp.com site (select Development Tools). HP is now providing Perl5 in order to support new products such as the Seceurity Patch Checker. Hopefully, Perl4 will soon disappear from HP-UX as it was designed to used with q4 only.


Bill Hassell, sysadmin
Darrell Allen
Honored Contributor

Re: Perl says reserverd word "our" is deprecated

Hi Clay,

Thanks for the reply. I had already changed the "shebang" to point to my version of Perl. I kinda expected an "upgrade Perl" answer though.

I installed 5.6.1 from the June applications cd and things are fine now.

Oh... thanks for the updated script.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
Darrell Allen
Honored Contributor

Re: Perl says reserverd word "our" is deprecated

Thanks for the info Ralph and Bill.

Ralph, you're welcome for the new hat! I see I put you over 500. Congratulations!

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)