Hi all,
I have written a program (listed at the end of this email) which is
designed to examine the arguments to the program and sort them into .C
files and .H files and then print them out together. It (attempts) to
do this by adding each .C file or .H file into an array @c_files or
@h_files respectively.
However, when I run the program I get the following error:
[buddrid@mit243linux ]$ ./remove_private.pl abc.C def.h ghi.H fdfff.c
syntax error at ./remove_private.pl line 10, near "@c_files ("
syntax error at ./remove_private.pl line 14, near "@h_files ("
Execution of ./remove_private.pl aborted due to compilation errors.
[buddrid@mit243linux ]$
Can anyone see what the problem is here? push as I understand it takes
2 parameters, an array followed by a list. I have tried to provide
these parameters as you can see in the code below. Any help greatly
appreciated. 8-)
thanks
David.
#!/usr/bin/perl
@c_files;
@h_files;
foreach $arg ( @ARGV )
{
if ( $arg =~ /\w\.[Cc]/ )
{
push @c_files ($arg);
}
if ( $arg =~ /\w\.[hH]/ )
{
push @h_files ($arg);
}
}
foreach $c_file ( @c_filse )
{
print "C file : $c_file \n";
}
foreach $h_file ( @h_files )
{
print "H file : $h_file \n";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
- code ref and objects todd shifflett
- Re: code ref and objects Wiggins d'Anconia
- Re: code ref and objects Jason Tiller
- Re: code ref and objects debraj bhattacharyya
- RE: push'ing items onto an array David Buddrige
- RE: push'ing items onto an array Beau E. Cox
- Re: push'ing items onto an array Paul Johnson
- Re: push'ing items onto an array David Buddrige
- Fwd: code ref and objects todd shifflett
- Re: Fwd: code ref and objects Jason Tiller