[19907] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2102 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 9 14:06:19 2001

Date: Fri, 9 Nov 2001 11:05:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1005332714-v10-i2102@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 9 Nov 2001     Volume: 10 Number: 2102

Today's topics:
    Re: 0 response from a DHCP client (jack)
    Re: 600 lines <mischief@velma.motion.net>
    Re: 600 lines <dover@nortelnetworks.com>
    Re: Anyone here know how to build HTML docs from Perl s <jeff@vpservices.com>
        apply chmod() to a symlink <grinsefisch@gmx.ch>
    Re: file copy problems (Tad McClellan)
        File Info in Perl (analyser)
        how to read stdin in a while... <f.benady@french-connexion.fr>
    Re: how to read stdin in a while... <ronh@iainc.com>
    Re: I am having a problem with my perl script.  <mischief@velma.motion.net>
    Re: I am having a problem with my perl script. (Rafael Garcia-Suarez)
    Re: I am having a problem with my perl script. (Anno Siegel)
    Re: I am having a problem with my perl script. <thepoet@nexgo.de>
    Re: I am having a problem with my perl script. <uri@stemsystems.com>
    Re: nested foreach - how to speed up or optimize ? <joe+usenet@sunstarsys.com>
    Re: nested foreach - how to speed up or optimize ? <joe+usenet@sunstarsys.com>
    Re: nested foreach - how to speed up or optimize ? <uri@stemsystems.com>
        newbie question <melmarc5@compuserve.de>
    Re: newbie question <hillr@ugs.com>
    Re: Regular Expressions <dphull@ku.ed.nospam.u>
    Re: Regular Expressions <dover@nortelnetworks.com>
    Re: Regular Expressions <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 9 Nov 2001 08:32:23 -0800
From: jack@brainminers.net (jack)
Subject: Re: 0 response from a DHCP client
Message-Id: <90de0398.0111090832.308c8e78@posting.google.com>

nobull@mail.com wrote in message news:<u9vggkp7sb.fsf@wcl-l.bham.ac.uk>...
> jack@brainminers.net (jack) writes:
> 
> > nobull@mail.com wrote in message news:<u94ro5qh8j.fsf@wcl-l.bham.ac.uk>...
> > > jack@brainminers.net (jack) writes:
> > >  
> > > >       use IO::Socket;
> > > 
> > > I suggest that you actually do! Use IO::Socket that is, don't just
> > > declare that you are going to use IO::Socket and then use the much
> > > more difficult primative socket interface instead.
> > > 
> > > There's nothing in your code to attempt to construct a valid DHCP
> > > request.  There is nothing in your code to attempt to specify the UDP
> > > source port as 68.  This has nothing to do with Perl.
> > 
> > But how you go about doing that?
> 
> Go about doing _what_?
> 
> Using IO::Socket?  See "perldoc IO::Socket" (et seq).
> 
> Finding out what constitutes a valid DHCP packet?  See relevant RFCs.
> 
> Constructing such a packet in Perl?  See "perldoc -f pack".
> 
> Binding the local port number of a UDP socket?  If using IO::Socket
> see "perldoc IO::Socket::INET".  If not using IO::Socket see "perldoc
> -f bind"


I appreciate all the information. Would it be all right for you to
provide the DHCP client sample code so I can learn how to do it since
I am a newbie on both networking programming and perl.

Thanks for all the help.


------------------------------

Date: Fri, 09 Nov 2001 16:06:00 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: 600 lines
Message-Id: <tunvn84kse1293@corp.supernews.com>

Armin Bauer <agp-soft@t-online.de> wrote:
> Hi!

> I'm asking for a friend, who's doing Perl programming.

Perhaps your friend should giv eyou more information to give us
if he can't ost himself.

> He has a problem. When his script becomes longer than 600 lines of code, the
> perl interpreter tells him, that there's a syntax error. he tried to put
> this code into a xyz.sub - file and require it but perl said, it was unable
> to find the file...

The perl system always says where a syntax error is. Chances are if it's
not on that exact line, it's a few lines up, causing a misparse which
makes the line number of the error unclear. As likely as not, there's
a missing closing quote, a missing closing parenthesis, a missing
right curly, or a missing semicolon at the end of a statement.

> Is it possible that this is a limitation of perl?

All things are possible, but there is no 600 line limit on a file
input to perl. I have programs with _much_ longer source files. That
might prove I need to do some refactoring into a more modular form,
but it definitely proves there's not a 600 line limit to input files.
I don't believe there's _any_ limit on the length of an input file
other than memory available to compile it. The only way I can see this
problem being due to a limitation of perl is that it might not be
showing your friend the exact place of the error in its report.

Chris

-- 
For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.



------------------------------

Date: Fri, 9 Nov 2001 10:02:10 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: 600 lines
Message-Id: <9sguq5$16h$1@bcarh8ab.ca.nortel.com>

"Rafael Garcia-Suarez" wrote...
>
> And the original problem is filtered through the OP, who is not a perl
> programmer, but who is speaking for a friend. So we don't know either
> what error is introduced by the 601th line.

And the problem may not *be* in the 601st line.  Might be a dropped quote,
missing semi-colon, etc. on some earlier statement.

-BD




------------------------------

Date: Fri, 09 Nov 2001 09:48:27 -0800
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Anyone here know how to build HTML docs from Perl src dist?
Message-Id: <3BEC16EB.FEADA537@vpservices.com>

jks@saba.bass wrote:
> 
> Is there anyone on this mailing list who knows a script to generate ALL of the
> Perl documentation in HTML format from the source distribution of Perl 5.6.1?

Rather than build from the source, I use a CGI which creates an HTML
version of the pod at the exact time I ask for it.  That way any new
mods I installed since the original build are included without me having
to update anything.  Just enter the name of a module in the form box and
away you go.  To see the Perl manpages, look for e.g. Pod::perlfunc. 

#!/usr/local/bin/perl -Tw
#
# podshow.cgi copyright 2001 by Jeff Zucker <jeff@vpservices.com>
#
# may be freely used by anyone with good intentions
# use Psych::ExamineThySelf if you don't know if they're good
#
$|++;
use strict;
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
use Pod::Html;
my $page = new CGI;
my $modname = $page->param('mod') || '';
show_form();
show_pod( $modname );

sub show_form {
    print
        $page->header,
        $page->start_html(-title=>'POD FINDER'),
        $page->start_form,
        $page->b("Module Name : "),
        $page->textfield(-name=>'mod'),
        $page->end_form,
        $page->end_html,
    ;
}

sub show_pod {
    my $modname = shift;
    return unless $modname;
    $modname =~ s#::#/#g;
    my $filename = findmod( $modname );
    pod2html("--quiet","--infile=$filename") if $filename;
}

sub findmod {
    my $mod = shift;
    if (-e $mod ) { return $mod; }
    for(@INC){
        my $modname = "$_/$mod.pm";
        if( -e $modname ) { return $modname; }
        $modname = "$_/$mod.pod";
        if( -e $modname ) { return $modname; }
    }
    return '';
}
__END__


Enjoy!

-- 
Jeff



------------------------------

Date: Fri, 09 Nov 2001 18:57:49 +0100
From: Radu Muschevici <grinsefisch@gmx.ch>
Subject: apply chmod() to a symlink
Message-Id: <9sh5es$hg3$1@wsc10.lrz-muenchen.de>

apparently, if perl's chmod() is applied on a symbolic link, it 
changes the owner of the file which the link points to.
but how can I change the owner of the symlink itself??

thanks
Radu


------------------------------

Date: Fri, 09 Nov 2001 16:59:09 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: file copy problems
Message-Id: <slrn9unutq.n36.tadmc@tadmc26.august.net>

maddman <maddman_75@yahoo.com> wrote:

>Thanks for all the replies.  


If you had followed my earlier suggestion, you would have more
info on _why_ the copy did not work.

I suggest you do what I already suggested you do.


>Yes, I did read the docs on File::Copy,
>and no I didn't understand it completely.


The $! variable will contain helpful information (eg. "file not found",
"permission denied"...).

print() it out so you can see what it says.


>copy($source, $dest) || warn "Can't do copy";

   copy($source, $dest) or die "could not copy '$source' to '$dest' $!";

>Could it be as issue with the space in the filename? 


I doubt that that is the problem.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: 9 Nov 2001 09:58:41 -0800
From: analysergreat@hotmail.com (analyser)
Subject: File Info in Perl
Message-Id: <72216665.0111090958.36db5ffb@posting.google.com>

hi,

  is there any module in perl which will help me find the date when a
software was installed on my winnt box. running perl v5.6.1  with sp6a
                   
                                     thanks..


------------------------------

Date: Fri, 9 Nov 2001 18:54:41 +0100
From: "Frank Benady" <f.benady@french-connexion.fr>
Subject: how to read stdin in a while...
Message-Id: <9sh561$3a2$1@wanadoo.fr>

Hello everybody

while (<>) {

    ...........................
    $myvar=<STDIN>
    ............................

}

doesn't give me time to enter myvar....?

Any help

Thank you




------------------------------

Date: Fri, 09 Nov 2001 18:36:20 GMT
From: "Ron Hartikka" <ronh@iainc.com>
Subject: Re: how to read stdin in a while...
Message-Id: <EmVG7.976$oM5.80070@typhoon.mw.mediaone.net>

<> is short for <STDIN>

while (<>){
    $myvar = $_;
}


"Frank Benady" <f.benady@french-connexion.fr> wrote in message
news:9sh561$3a2$1@wanadoo.fr...
> Hello everybody
>
> while (<>) {
>
>     ...........................
>     $myvar=<STDIN>
>     ............................
>
> }
>
> doesn't give me time to enter myvar....?
>
> Any help
>
> Thank you
>
>




------------------------------

Date: Fri, 09 Nov 2001 16:45:38 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: I am having a problem with my perl script. 
Message-Id: <tuo21ic18cl727@corp.supernews.com>

The Williamsons <daffyduk@prodigy.net> wrote:
> I am having a problem with my perl script.

> I am trying to mv info from one location to another and the script says its
> done but the info is not there?

Are you sure it says it's done?

> This is the part of the script that is messed up:

> system("mv" .$file . "/directory/new" .$file);

System returns the exit value of the program it was used to launch.
On Unix and most other operating systems, the system utilities and
most other programs return 0 for success because there's only one
integer you can return to the parent, with only one way to run
successfully and multiple ways to fail. Therefore, the special
value is 0, and anything else is a failure code. If you think about
it _as_ a 'Failure Code' instead of just a return value, it makes
a lot of sense that a successful program returns 0.

A common mistake, since most Perl functions return a true value upon
success, is to try to do the same sort of thing with system() as with
other builtin functions. The following line of code seems to make sense:

    ### incorrect
    system('/bin/ls') || warn "Couldn't list files using ls!\n";
    ### incorrect

However, it's wrong. You can test to see if system()'s return value is
equal to 0 -- which is what I recommend --  or you can negate the value
of the system call or change the boolean test from logical or to logical
and.

   ### correct
   system('/bin/ls') == 0 || warn 'Couldn't list files using ls!\n";
   ### correct

Be careful if you're using system() to call some unusual program,
though, because if that program returns nonzero for success and zero
for failure, then system() will readily switch polarity on you. It
is unfortunate that anyone would be so silly as to buck that
convention needlessly, but there are on rare occassions good reasons
to do so. Personally, I think those occassions should be ignored, and
the convention should be kept. Too bad it makes things like this
difficult to get right if you include that type of program:

    foreach ( qw{ program1 program2 program3 } ) {
        system ( $_ ) == 0 || warn "Program $_ was not successful!\n";
    }

If one or more of the programs is backwards, you'd have to test for
that in the loop based on the name of the program and hope got it
right. It's nearly impossible to guess that a program will have a
backwards exit value without knowing something about it, and therefore
this is even stranger territory if you trust your path or allow the
user to pick a program to run. 

So, in short, from what you posted, my best guess is that you're
testing the opposite of what you thought you were testing.

Chris

-- 
For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.



------------------------------

Date: 9 Nov 2001 16:01:09 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: I am having a problem with my perl script.
Message-Id: <slrn9unvf5.cqi.rgarciasuarez@rafael.kazibao.net>

The Williamsons wrote in comp.lang.perl.misc:
> I am having a problem with my perl script.
> 
> I am trying to mv info from one location to another and the script says its
> done but the info is not there?
> 
> This is the part of the script that is messed up:
> 
> system("mv" .$file . "/directory/new" .$file);
           ^^^        ^^^
    Aren't there some spaces missing ?

NB. It's better to use the multi-argument version of system :
    system('/bin/mv',$file,"/directory/new/$file");
because this protects you in case of $file has spaces or shell
metacharacters in it.

You can also use the rename() builtin function in place of system(), but
be sure to check out the description of rename() before doing so.

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


------------------------------

Date: 9 Nov 2001 16:10:05 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: I am having a problem with my perl script.
Message-Id: <9sgv4t$gqf$3@mamenchi.zrz.TU-Berlin.DE>

According to The Williamsons <daffyduk@prodigy.net>:
> I am having a problem with my perl script.
> 
> I am trying to mv info from one location to another and the script says its
> done but the info is not there?
> 
> This is the part of the script that is messed up:
> 
> system("mv" .$file . "/directory/new" .$file);

You should check the return value of the system() call to see if the
command succeeded.  See "perldoc -f system" on how to do that. Also, if
you have doubts about an exterior command, it is always a good idea to
print the command instead of executing it to see if it's sane.  Do

    print("mv" .$file . "/directory/new" .$file);
    print "\n";

and see what that shows you.

You should also consider using Perl's internal rename() function instead
of the external mv.  If you don't move across file system boundaries,
it does the same thing.

Anno


------------------------------

Date: Fri, 9 Nov 2001 17:21:05 +0100
From: "Christian Winter" <thepoet@nexgo.de>
Subject: Re: I am having a problem with my perl script.
Message-Id: <9sgvkn$t0l$1@newsread2.nexgo.de>

"The Williamsons" <daffyduk@prodigy.net> wrote:
> I am having a problem with my perl script.
>
> I am trying to mv info from one location to another and the script says
its
> done but the info is not there?
>
> This is the part of the script that is messed up:
>
> system("mv" .$file . "/directory/new" .$file);

A rather ugly line.

my @args = ( "/bin/mv", $file, "/directory/new/".$file ) == 0
            or die "system @args failed. Return value: $?";

should give more output.

Maybe you're missing some whitespaces in your vars, or
a slash (after "/directory/new"), maybe you've forgotten to
chomp off a newline in $file or you're running the script
in an environment (Webserver) which has no path to "mv".
Many possibilities...

Greetings
Christian




------------------------------

Date: Fri, 09 Nov 2001 17:57:11 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: I am having a problem with my perl script.
Message-Id: <x7bsibsu6p.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  >> system("mv" .$file . "/directory/new" .$file);

  AS> You should check the return value of the system() call to see if the
  AS> command succeeded.  See "perldoc -f system" on how to do that. Also, if
  AS> you have doubts about an exterior command, it is always a good idea to
  AS> print the command instead of executing it to see if it's sane.  Do

  AS>     print("mv" .$file . "/directory/new" .$file);
  AS>     print "\n";

often when i use system, i build up the string or list in another
variable just so i can print or log it. then i call system on that
variable. a nice habit to make as what you pass to system is usually
worth knowing.

so i would have done something like (with spaces and a single string):

	my $cmd = "mv" .$file . "/directory/new" .$file ;
	print "system '$cmd'\n" ;
	system $cmd ;

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: 09 Nov 2001 12:37:49 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: nested foreach - how to speed up or optimize ?
Message-Id: <m3pu6rn8uq.fsf@mumonkan.sunstarsys.com>

"Grzegorz Goryszewski" <gregory@pharmag.pl> writes:

> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:9sgaks$krq$1@mamenchi.zrz.TU-Berlin.DE... 
> > According to Grzegorz Goryszewski <gregory@pharmag.pl>:
> 
> > As far as I can see, you should be able to get essentially the same
> > output (probably in a different sequence) with a single loop:

[...]

> Thank You for suggestions, finally I've come to this :

Did you *try* Anno's suggestion?  You have three hashes with
two conditions:

  %zakoncz 's key is %rospocz 's key
  %user    's key is %zakoncz 's value->[2]

That looks like a single loop over 'keys %rozpocz' to me (untested):

  foreach ( grep ref $zakoncz{$_} and exists $user{$zakoncz{$_}[2]},
                 keys %rozpocz ) 
  {
    my @r = @{  $rozpocz{$_}  };
    my @z = @{  $zakoncz{_}   };
    my @u = @{  $user{$z[2]}  };

    printf << 'FMT' => $z[2], $r[0], $z[0], $r[1], $z[1], $u[0], $u[1];
  user,%s,strt,%s,endt,%s,strdta,%s,enddta,%s,%s,%s
  FMT

  }

-- 
Joe Schaefer            "Familiarity breeds contempt -- and children."
                                               --Mark Twain



------------------------------

Date: 09 Nov 2001 13:16:06 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: nested foreach - how to speed up or optimize ?
Message-Id: <m3hes3n72x.fsf@mumonkan.sunstarsys.com>

Joe Schaefer <joe+usenet@sunstarsys.com> writes:

>     my @r = @{  $rozpocz{$_}  };
>     my @z = @{  $zakoncz{_}   };
                           ^

Typo- sorry.  That line should read

      my @z = @{  $zakoncz{$_}  };


-- 
Joe Schaefer           "We are all naive; only about different things."
                                               --Mark Twain



------------------------------

Date: Fri, 09 Nov 2001 18:43:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: nested foreach - how to speed up or optimize ?
Message-Id: <x71yj7ss20.fsf@home.sysarch.com>

>>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:

  JS> Joe Schaefer <joe+usenet@sunstarsys.com> writes:
  >> my @r = @{  $rozpocz{$_}  };
  >> my @z = @{  $zakoncz{_}   };

  JS> Typo- sorry.  That line should read

  JS>       my @z = @{  $zakoncz{$_}  };

with those variable names how can you tell if you made a typo? 

<i do see it was $_ that was mistyped>

:-)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: Fri, 9 Nov 2001 17:33:14 +0100
From: "Adrian Engeländer" <melmarc5@compuserve.de>
Subject: newbie question
Message-Id: <9sh0ln$13lgh1$1@ID-116709.news.dfncis.de>

hi there,

perl programs start with

#!/usr/bin/perl/

what do i have to write on windows if my perl location is:
d:\perl\bin\perl.exe

thx

adrian




------------------------------

Date: Fri, 9 Nov 2001 08:53:24 -0800
From: "Ron Hill" <hillr@ugs.com>
Subject: Re: newbie question
Message-Id: <3bec083c$1@usenet.ugs.com>

"Adrian Engeländer" <melmarc5@compuserve.de> wrote in message
news:9sh0ln$13lgh1$1@ID-116709.news.dfncis.de...
> hi there,
>
> perl programs start with
>
> #!/usr/bin/perl/
>
> what do i have to write on windows if my perl location is:
> d:\perl\bin\perl.exe
>
[snipped]

please see perldoc -q #!perl
 How can I get "#!perl" to work on [MS-DOS,NT,...]?

           For OS/2 just use

               extproc perl -S -your_switches

           as the first line in "*.cmd" file ("-S" due to a bug in
           cmd.exe's `extproc' handling). For DOS one should first invent a
           corresponding batch file and codify it in "ALTERNATIVE_SHEBANG"
           (see the INSTALL file in the source distribution for more
           information).

           The Win95/NT installation, when using the ActiveState port of
           Perl, will modify the Registry to associate the ".pl" extension
           with the perl interpreter. If you install another port, perhaps
           even building your own Win95/NT Perl from the standard sources
           by using a Windows port of gcc (e.g., with cygwin or mingw32),
           then you'll have to modify the Registry yourself. In addition to
           associating ".pl" with the interpreter, NT people can use: "SET
           PATHEXT=%PATHEXT%;.PL" to let them run the program
           "install-linux.pl" merely by typing "install-linux".

           Macintosh Perl programs will have the appropriate Creator and
           Type, so that double-clicking them will invoke the Perl
           application.

           *IMPORTANT!*: Whatever you do, PLEASE don't get frustrated, and
           just throw the perl interpreter into your cgi-bin directory, in
           order to get your programs working for a web server. This is an
           EXTREMELY big security risk. Take the time to figure out how to
           do it correctly.

Ron Hill





------------------------------

Date: Fri, 9 Nov 2001 10:06:08 -0600
From: "Dave Hull" <dphull@ku.ed.nospam.u>
Subject: Re: Regular Expressions
Message-Id: <9sgutg$cvt$1@news.cc.ukans.edu>

"Anya Miretsky" <anyam_99@yahoo.com> wrote in message
news:1e0c6f7a.0111090745.385e55b@posting.google.com...
> I am new to Perl, so therefore the simple question..
>
> How do I use a regular expression to make all uppercase letters in a
> string into lowercase?
>
> I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work. I've also
> looked at the perlre man page and the Camel book, but can't find what
> I need.

If you're not required to use a regular expression for this, look at the
"uc" function which converts its argument to uppercase.




------------------------------

Date: Fri, 9 Nov 2001 09:57:21 -0600
From: "Bob Dover" <dover@nortelnetworks.com>
Subject: Re: Regular Expressions
Message-Id: <9sguh3$m1$1@bcarh8ab.ca.nortel.com>

"Anya Miretsky" wrote...
>
> How do I use a regular expression to make all uppercase letters in a
> string into lowercase?
>
$x = lc($x);

-BD




------------------------------

Date: Fri, 09 Nov 2001 17:52:19 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Regular Expressions
Message-Id: <x7eln7sueu.fsf@home.sysarch.com>

>>>>> "DH" == Dave Hull <dphull@ku.ed.nospam.u> writes:

  DH> "Anya Miretsky" <anyam_99@yahoo.com> wrote in message
  DH> news:1e0c6f7a.0111090745.385e55b@posting.google.com...
  >> I am new to Perl, so therefore the simple question..
  >> 
  >> How do I use a regular expression to make all uppercase letters in a
  >> string into lowercase?
  >> 
  >> I've tried $x =~ s/[A-Z]/[a-z]/g; and this doesn't work. I've also
  >> looked at the perlre man page and the Camel book, but can't find what
  >> I need.

  DH> If you're not required to use a regular expression for this, look
  DH> at the "uc" function which converts its argument to uppercase.

methinks you meant lc and lowercase. read the OP again.

:)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
-- Stem is an Open Source Network Development Toolkit and Application Suite -
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 2102
***************************************


home help back first fref pref prev next nref lref last post