Re: What's wrong with this program?

From: Uri Guttman (uri_at_stemsystems.com)
Date: 01/05/05


Date: Wed, 05 Jan 2005 20:34:40 GMT


>>>>> "L" == Leon <lianjian@caip.rutgers.edu> 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  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


Relevant Pages

  • Re: Delaying interpolation in a qr
    ... BC>}>> I have a regular expression that includes a ... BC>} up a hash of qr's and select the needed one in the actual regex. ... BC> sub scan ... you can't delay the interpolation with just qr (other ...
    (comp.lang.perl.misc)
  • Re: qr and subroutines
    ... [SNIP] ... Your $tmp_regex is not a regex, ... I shouldn't have referred to the string as "regex", ... sub rework_uri { ...
    (comp.lang.perl.misc)
  • Re: Select specific text in cell
    ... c:filename.ext and the operating system will look in the ... following code (showing a 'backslashless' path reference) prints the first ... End Sub ... Well, as written, the regex would retain the C:. ...
    (microsoft.public.excel.misc)
  • Re: speed issues with pattern matching and substitution
    ... >> substitute them for their corresponding pairs, ... > compilatiion of the regex outside the loop. ... This is a classic bit of Perl. ... sub precomp { ...
    (comp.lang.perl.misc)
  • qr and subroutines
    ... sub build_url { ... my $tmp_regex = shift; ... in the actual regex function itself, and I get what I want. ...
    (comp.lang.perl.misc)