Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > What's wrong with this program?

Reply
Thread Tools

What's wrong with this program?

 
 
Leon
Guest
Posts: n/a
 
      01-05-2005


#!/usr/bin/perl
use File::Find;

find(\&d, @ARGV);
sub d{
my $file=$File::Find::name;
$file =~ tr/A-Z/a-z/g;
print $file, "\n";
}

The error message is:
Bareword found where operator expected at re.sh line 7, near
"tr/A-Z/a-z/g"
syntax error at re.sh line 7, near "tr/A-Z/a-z/g"
Execution of re.sh aborted due to compilation errors.
What's wrong with this program?
Thanks a lot.

 
Reply With Quote
 
 
 
 
Uri Guttman
Guest
Posts: n/a
 
      01-05-2005
>>>>> "L" == Leon <(E-Mail Removed)> writes:

L> #!/usr/bin/perl
L> use File::Find;

L> find(\&d, @ARGV);
L> sub d{
L> my $file=$File::Find::name;
L> $file =~ tr/A-Z/a-z/g;
^
L> print $file, "\n";
L> }

L> The error message is:
L> Bareword found where operator expected at re.sh line 7, near
L> "tr/A-Z/a-z/g"
L> syntax error at re.sh line 7, near "tr/A-Z/a-z/g"

tr IS NOT a regex nor is it s///. it has its own modifiers.

perldoc -f tr

uri

--
Uri Guttman ------ http://www.velocityreviews.com/forums/(E-Mail Removed) -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
 
Reply With Quote
 
 
 
 
Tom Regner
Guest
Posts: n/a
 
      01-05-2005
Leon wrote:

> #!/usr/bin/perl
> use File::Find;
>
> find(\&d, @ARGV);
> sub d{
> my $file=$File::Find::name;
> $file =~ tr/A-Z/a-z/g;
> print $file, "\n";
> }
>

read perldoc perlop again, and then take out the not existing g modifier

regards,
tom
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Have I bought wrong product? enquirer Wireless Networking 2 06-10-2005 10:59 PM
Zero Config keeps connecting to the wrong AP =?Utf-8?B?ZGdyaWZmaXRo?= Wireless Networking 2 03-04-2005 05:52 PM
Is XML Doc wrong or is Schema wrong? (or both) Matthew XML 7 01-07-2005 10:05 PM
wrong connection status Peter Welk Wireless Networking 0 12-22-2004 03:26 PM
XP SP2 Wrong IP on connection D Wells Wireless Networking 3 12-09-2004 03:35 AM



Advertisments