RE: Use Strict Error

2004-01-23 Thread Wiggins d Anconia
Please bottom post.

> 1. You are missing ";" 
> Type
> `egrep $name testing.txt`;
> And not
> 'egrep $name testing.txt'
> 
> Not the backticks and not quotes ...
> 

There's also no reason to use backticks in void context.

perldoc -f system

Please use full paths, error check, etc. if you are going to shell out,
which brings me to the next point, why shell out to 'egrep' in the first
place, you should either do it in Perl using open, while, a regex, etc.
or use a shell script

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Use Strict Error

2004-01-23 Thread Rob Dixon
Bill Jastram wrote:
>
> When I use the following portion of Perl code:
> __
>
> #!/usr/bin/perl
> # use with:
> # perl IfThenElse tfcfam (Use all of this at the command line!)
>
> use strict;
> use warnings;
>
> print "Search by name: ";
>
> my $name = ;
> 'egrep $name testing.txt'
>
> #my(@col1, @col2, @col3);
> my @col1;
> my @col2;
> my @col3;
> my $col = 1;
> my ($find);
>
> __
>
> I get the following error:
>
> syntax error at trashthistest2 line 17, near "my "
> Global symbol "@col1" requires explicit package name at trashthistest2 line 17.
> Global symbol"@col1" requires explicit package name at trashthistest2 line 40.
> Global symbol "@col1" requires explicit package name at trashthistest2 line 53.
> Global symbol "@col1" requires explicit package name at trashthistest2 line 59.
> Global symbol "@col1" requires explicit package name at trashthistest2 line 81.
> Execution of trashthistest2 aborted due to compilation errors.
>
> __
>
> If I have declared my @col1 at line 17, why am I getting these errors?

Hi Bill.

Your code isn't the most maintainable I've seen (your line 17 is the 14th in
the code you showed) but what's the stray string

> 'egrep $name testing.txt'

doing at 'line 14'? Slap a semicolon after it and it will compile, but then
you've just shelled out, run 'egrep' and thrown the results away.

May I also make a preemptive strike and say that you seem to be writing a
shell script in Perl. Almost all backticks or 'system' calls are a bad idea:
Perl usually knows how to do it better than you do, so code it in Perl.

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Use Strict Error

2004-01-23 Thread NYIMI Jose (BMB)
1. You are missing ";" 
Type
`egrep $name testing.txt`;
And not
'egrep $name testing.txt'

Not the backticks and not quotes ...

HTH,

José.

-Original Message-
From: Bill Jastram [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 23, 2004 4:00 PM
To: [EMAIL PROTECTED]
Subject: Use Strict Error


When I use the following portion of Perl code: 
__

#!/usr/bin/perl
# use with:
# perl IfThenElse tfcfam (Use all of this at the command line!)

use strict;
use warnings;

print "Search by name: ";

my $name = ;
'egrep $name testing.txt'

#my(@col1, @col2, @col3);
my @col1;
my @col2;
my @col3;
my $col = 1;
my ($find);

__

I get the following error:

syntax error at trashthistest2 line 17, near "my " 
Global symbol "@col1" requires explicit package name at trashthistest2 line 17. 
Global symbol"@col1" requires explicit package name at trashthistest2 line 40. 
Global symbol "@col1" requires explicit package name at trashthistest2 line 53. Global 
symbol "@col1" requires explicit package name at trashthistest2 line 59. 
Global symbol "@col1" requires explicit package name at trashthistest2 line 81. 
Execution of trashthistest2 aborted due to compilation errors.

__

If I have declared my @col1 at line 17, why am I getting these errors?

Thanks for any assitance you can offer.

Bill J.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]  





 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]