[9197] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2815 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 5 11:17:27 1998

Date: Fri, 5 Jun 98 08:00:42 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 5 Jun 1998     Volume: 8 Number: 2815

Today's topics:
    Re: -d ? 3 : 7 is ambiguous, how comes? (M.J.T. Guy)
    Re: -d ? 3 : 7 is ambiguous, how comes? <jdporter@min.net>
    Re: ??change case on FIRST letter ONLY in a word?? chrishabs@my-dejanews.com
        [Q] CPU usage audit routine <NOSPAMkEynOn@panix.comNOSPAM>
    Re: blat error message <warp@internetcom.com.br>
        Calling a Java scipt from perl Eadmund@writeme.com
    Re: converting unix perl to nt perl <mhickey@reed.edu>
        Couple of Newbie Questions disney7@mindspring.com
    Re: Couple of Newbie Questions (Mike Stok)
        EICN DHCPD v0.902b for NT is available ! <reichen@eicn.ch>
    Re: Foreach Efficiency <jdporter@min.net>
    Re: Help ! setup noecho connection <aqumsieh@matrox.com>
    Re: Help!!!! "ccperl -e" behaves differently under UNIX <ping.cui@daytonoh.ncr.com>
    Re: How do I get text counter perl script to work??? <quednauf@nortel.co.uk>
    Re: How do I test MacPerl CGI scrips using my local Bro <westmj@esvax.dnet.dupont.com>
        HTML to PERL translation Conversion Eadmund@writeme.com
    Re: HTML to PERL translation Conversion <quednauf@nortel.co.uk>
    Re: Incrementing zero-padded numbers (Rob Greenbank)
    Re: Is PERL case sensitive? (Mike Stok)
    Re: Is PERL case sensitive? <jdporter@min.net>
        No, It's Not (was Re: Yes, it is) <jdporter@min.net>
    Re: numeric $value to string (Bbirthisel)
    Re: numeric $value to string ptimmins@netserv.unmc.edu
    Re: Perl DBI + Postgres? (Gabor)
        Perl Intepreter for Solaris <ghimsj@apwinc.sookmyung.ac.kr>
    Re: Perl Intepreter for Solaris <aqumsieh@matrox.com>
    Re: problem using LWP <jdporter@min.net>
    Re: problem using variables for waitfor in telnet modul (John Kelly)
        Problem: Perl on Linux <nw22@le.ac.uk>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 5 Jun 1998 11:45:10 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <6l8lo6$7q2$1@lyra.csx.cam.ac.uk>

Larry Rosler <lr@hpl.hp.com> wrote:
>pinard@iro.umontreal.ca says...
>> 
>> 	perl -e '$x[1,2,3]=7;print $x[3]'
>> 
>> while I should have tried:
>> 
>> 	perl -e '@x[1,2,3]=7;print $x[3]'
>
>Make that 'retracing my mistakeS :-).'  $x[3] is undefined in either 
>case.  Surely you meant $x[2].

$x[3] is defined in the first case, but not in the second.   Even in
the second case, $x[3] is assigned to; it's just that the value assigned
is undef().    I doubt that $x[2] is meant either way.

>                                And you would probably be wise to type 
>'perl -ew' instead of 'perl -e' in any case.

Only if you really wanted to execute the script 'w'.    Try 'perl -we'
instead.


Mike Guy
 ...   who has always hated that message "Use of uninitialised ... "
     when you _have_ initialised it to undef().


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

Date: Fri, 05 Jun 1998 13:55:40 GMT
From: John Porter <jdporter@min.net>
Subject: Re: -d ? 3 : 7 is ambiguous, how comes?
Message-Id: <3577FA74.2077@min.net>

Ronald J Kimball wrote:
> 
> John Porter <jdporter@min.net> wrote:
> 
> > > So, you say that a scalar in list context is interpreted as a list
> > > containing only that scalar.
> >
> > No, he didn't say that.  Only clueless newbies say that.
> > It isn't true.  In fact, "there is no such thing as a scalar in a
> > list context."  This has been belabored many MANY times in this
> > newsgroup.
> 
> I believe the statement which has actually been belabored many MANY
> times is "there is no such thing as a list in a scalar context." 

Yes, you're right.  
I need more coffee.  
On second thought, I need more sleep.

None the less,
	$s = @a
is crucially different from
	$s = ( $x, $y )
and in similar fashion,
	@a = $s
is crucially different from
	( $x, $y ) = $s

John Porter


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

Date: Fri, 05 Jun 1998 12:18:06 GMT
From: chrishabs@my-dejanews.com
Subject: Re: ??change case on FIRST letter ONLY in a word??
Message-Id: <6l8nlu$j76$1@nnrp1.dejanews.com>



>
> OK, I give up!!!
>
> if the FIRST and ONLY first letter in an input string is lower, how do I
> change it to uppercase without changing all the other letters in the
string???
>

perlfunc and perlre would have shown mtowtdi:

$string = ucfirst($string)
or
$string = "\u$string"

Chris H.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 5 Jun 1998 14:54:14 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: [Q] CPU usage audit routine
Message-Id: <6l90qm$9jm@news1.panix.com>




Hi.  I need to write a routine to perform a round-the-clock audit of
CPU usage among the users of a networked system.  The goal is to be
able to generate a daily report of the total number of
CPU-hours/day/machine/user.  The system is a hybrid of roughly the
same number of Linux boxes and SGI workstations.

I think that Perl is the way to go for this, but other than that, I
don't even know where to start.  Is there anything like this already
freely available in Netland?  Alternatively, can someone recommend
a place to look for a quick clue?

Many thanks,

K.

-- 
To reply directly by e-mail, remove the upper-case letters from the
return address in the header.



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

Date: Fri, 5 Jun 1998 11:18:49 -0300
From: "BBQ" <warp@internetcom.com.br>
Subject: Re: blat error message
Message-Id: <6l8uor$f35@www001.itanet.com.br>

On a side note, there is a comercial version of Sendmail for NT, which can
be found at http://www.demobuilder.com/sendmail.htm

Although Blat is freeware, it does help if you are writting your stuff on NT
and then deploying it on UNIX servers. This way, all you have to do is
change your $mail_prog when switching OSes.

Hope this helps.
BBQ

0312@my-dejanews.com <0312@my-dejanews.com> wrote in message
<6l7cm8$r6g$1@nnrp1.dejanews.com>...
>Hi seniors:
>
>I have running iis4.0. and try to make blat work under NT, and it does
>work well before, However it seems to be some problems now that blat
refused
>to send mail again, the error message is " the smtp server does not like
>anyid@anydomain.com,  have you set 'to:' field properly"
>
>I have totally lost now since i have tries to fix it myself several
>times and every try was ended in vain.
>
> Could anybodygive me some clue?
>
>thanks
>
>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/   Now offering spam-free web-based newsreading




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

Date: Fri, 05 Jun 1998 14:22:41 GMT
From: Eadmund@writeme.com
Subject: Calling a Java scipt from perl
Message-Id: <6l8uvh$tp2$1@nnrp1.dejanews.com>

Hi all,

I Know it's probably a simple thing to do , but, could someone please give me
an example of a piece of Perl script that generates a html output including a
java script which will then run; this is what I have now, and it does'nt
work!!

sub HTMLPrintRegisterSuccess {
    local($main_script, $form_tags) =
	@_;
    print <<__END_OF_REGISTER_SUCCESS__;
<HTML><HEAD>
<TITLE>Registration Added</TITLE>

<script LANGUAGE="JavaScript">

//      - - - - - - - - Get Decoded Value of Cookie - - - - - - - -


function getCookieVal (offset) {
        var endstr = document.cookie.indexOf (";", offset);
               if (endstr == -1)
               endstr = document.cookie.length;
        return unescape(document.cookie.substring(offset, endstr));
        }


//      - - - - - - - - Get Value of Cookie - - - - - - - -


function GetCookie (name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
        var j = i + alen;
                if (document.cookie.substring(i, j) == arg)
                return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
                if (i == 0) break;
        }

return null;
}


//      - - - - - - - - Set Value of Cookie - - - - - - - -


function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
}


//      - - - - - - - - End of Public Domain Cookie Code - - - - - - - -




function show_count() {
        var expdate = new Date();
        var num;
        expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
                if(!(num = GetCookie("jtotwcount")))
                num = 0;
        num++;
        SetCookie ("jtotwcount", num, expdate);
                if (num == 1) document.write("Since this is the first time
you have been to this tip, please take a moment to look around.");
                else document.write("You have been here " + num + " times.");


}


function auto_show_name() {
        if(GetCookie("jtotwname") != null) {
            document.write("Welcome back to this week\'s tip " + GetCookie
('jtotwname') + ". ");
		 }
        else {
            document.write("<FORM>Please enter your name: <INPUT TYPE =
\"text\" NAME = \"nameinput\">" + "<BR><BR><INPUT TYPE = \"button\" VALUE =
\"Save to Cookie\" onClick = \"set_name(this.form)\"></FORM>");
            document.write("Please enter your first name in the input" + "
box and press the \"Save to Cookie\" button, then the page will automatically
reload. ");
        }
}


function set_name(form) {
        var expdate = new Date ();
        expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 31));
        var username = form.nameinput.value
                if (username != "") {
                        if (confirm("Are you sure you want this saved as your
name?")) {
                        SetCookie ("jtotwname", username, expdate);
                        window.history.go(0);
                        }

                }
                else alert("Geez, at least enter something, entering nothing
will cause an error.");
}
</script>

</HEAD>
<BODY>
<script LANGUAGE="JavaScript">
auto_show_name();
show_count();
</script>
<CENTER>
<H2>You Have been added to the user database</h2>
</center>
<hr>
<FORM METHOD=POST ACTION=$main_script>
$form_tags
<BLOCKQUOTE>
    $auth_register_message
</Blockquote>
<center>
<input type=submit name=auth_logon_screen_op value="Return to Logon Screen")
</center>
</form>
</body>
</HTML>
__END_OF_REGISTER_SUCCESS__

} # End of RegisterSuccess



Ta

Ed

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 4 Jun 1998 15:53:59 -0700
From: youth philharmonic <mhickey@reed.edu>
To: Daniel Ritter <dritter@interpro.ch>
Subject: Re: converting unix perl to nt perl
Message-Id: <Pine.OSF.3.96.980604154800.27828B-100000@amon.reed.edu>

> Does anybody have any expirience converting a simple feedback / order form
> perl-script running on a
> unix server using sendmail to NT using Netscape Messaging server 3.01 ?

I have heard that a shell utilty called "Blat" will do the trick, though I
personally found it intolerable...  My solution was to use SMTP directly -
that is connecting to the SMTP port on a server and sending mail that way,
like:
	$socket = IO::Socket::INET->new(Proto     => "tcp",
                                PeerAddr  => $mailhost,
                                PeerPort  => $port)
	or die "Can't connect to port $port on $mailhost: $!";

	# the discussion with the SMTP server:
	$response = <$socket>;
	$response = <$socket>;
	$socket->send("HELO $senderdomain\n");
	$response = <$socket>;
	$socket->send("MAIL FROM:$sender\n");
	$response = <$socket>;
	$socket->send("RCPT TO:$mailto\n");
	$response = <$socket>;
	$socket->send("DATA\n");
	$response = <$socket>;
	$socket->send("$message\n.\n");
	$response = <$socket>;
	$socket->send("QUIT\n");
	$response = <$socket>;

Things get a bit wierd doing it this way though... Hope this helps.



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

Date: Fri, 05 Jun 1998 12:53:27 GMT
From: disney7@mindspring.com
Subject: Couple of Newbie Questions
Message-Id: <6l8po7$m3t$1@nnrp1.dejanews.com>

1) How can you pull a Linux shell variable into a Perl program?
   Right now I am having to:
   echo $4 >file.txt
   before running the perl script and then open and read file.txt
   from the Perl script. I tried just using $4 from within Perl,
   but it isn't the same variable as it is reported as undefined.
   There must be a way to pull the variable straight in.

2) How can you make Perl default to looking for files in the
   directory the script was run from. I have to use complete
   pathnames (ie. /etc/ppp/output.txt), if I don't the file
   will end up in the root directory. I'm not sure if this
   happens when run by hand... but it does if the perl script
   is executed by the system (from within ip-up, cron, etc.)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 5 Jun 1998 14:37:16 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Couple of Newbie Questions
Message-Id: <6l8vqs$i32@news-central.tiac.net>

In article <6l8po7$m3t$1@nnrp1.dejanews.com>,  <disney7@mindspring.com> wrote:
>1) How can you pull a Linux shell variable into a Perl program?
>   Right now I am having to:
>   echo $4 >file.txt
>   before running the perl script and then open and read file.txt
>   from the Perl script. I tried just using $4 from within Perl,
>   but it isn't the same variable as it is reported as undefined.
>   There must be a way to pull the variable straight in.

If the variable is in the evironment set up by the shell for the
program then 

  $ENV{'4'}

will get the environment variable you would have refered to as $4 in the
shell.  There's more info on this in the perlvar manual page.

>2) How can you make Perl default to looking for files in the
>   directory the script was run from. I have to use complete
>   pathnames (ie. /etc/ppp/output.txt), if I don't the file
>   will end up in the root directory. I'm not sure if this
>   happens when run by hand... but it does if the perl script
>   is executed by the system (from within ip-up, cron, etc.)

If your process is run by cron maybe its current working directory is the
user's home directory.  The cron man page might tell you more about this.
One solution might be to have something like

  $DIR = '/etc/ppp';

  chdir ($DIR) || die "$0: can't chdir to $DIR ($!)\n";

in your script.

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 05 Jun 1998 12:59:07 +0200
From: Nils Reichen <reichen@eicn.ch>
Subject: EICN DHCPD v0.902b for NT is available !
Message-Id: <3577CF7B.4338@eicn.ch>

EICNDHCPD v0.902b: static DHCP server for NT4 !


See http://neli00.eicn.etna.ch/~reichen/eicndhcpd.htm

-- 
-------------------------------------------------------
- Nils Reichen                       Linux2,NT4,(VMS) -
- ETS Engineer                Pascal,C,Perl,(Fortran) -
- EICN LeLocle Switzerland                            -
-------------------------------------------------------
- Internet contact of "La Fario"                      -
-------------------------------------------------------
- http://neli00.eicn.etna.ch/~reichen/eicndhcpd.htm   -
- http://neli00.eicn.etna.ch/~reichen/getmac.htm      -
-------------------------------------------------------


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

Date: Fri, 05 Jun 1998 14:36:49 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Foreach Efficiency
Message-Id: <35780420.230F@min.net>

Peter A Fein wrote:
> 
> John Porter <jdporter@min.net> writes:
> > Why don't you test your hypothesis using Benchmark?
> 
> Well, because I have finals in a few days and I need to get this
> working yesterday.  Although I'd like to mess around & benchmark parts
> of my code at some point, that point is not now.  

In that case, why are you bothering with usenet at all?
If you're not sure whether one way is semantically equivalent to the
other way, just go with the one you know, and get on with it.

John Porter


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

Date: Fri, 05 Jun 1998 10:36:23 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Help ! setup noecho connection
Message-Id: <35780267.B1E9FA1D@matrox.com>

stuart@ilanet.slnsw.gov.au wrote:

> hi all,
>
> Does any know how to set noecho on a socket connection. I needed to ask
> user password but i want the password to be hidden.

I do!
Hint #1 : It's documented in the FAQs.
Hint #2 : Search DejaNews ... that question has been posted a zillion
times.
Hint #3 : It depends on your platform.

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Fri, 05 Jun 1998 08:45:04 -0400
From: Ping Cui <ping.cui@daytonoh.ncr.com>
Subject: Re: Help!!!! "ccperl -e" behaves differently under UNIX and Windows 95
Message-Id: <3577E850.A724DB26@daytonoh.ncr.com>

Thanks for everyone. I was writing a cross platform trigger for a tool so that the
trigger could
correctly fire under both UNIX and Windows environment. Replacing Windows command
interpreter is not my option. Looks like I am running into a wall. Thanks for help
any way.

Ping

Mike Stok wrote:

> In article <3577172F.D909B203@daytonoh.ncr.com>,
> Ping Cui  <ping.cui@daytonoh.ncr.com> wrote:
> >Hello everyone:
> >
> >    Could you please help me explain  why perl behaves differently under
> >following cases?
> >
> >Case 1:
> >
> >perl -e '$a = "111111";print $a'
> >
> >(working under UNIX,
> >not working under windows 95 and getting an error
> >"Can't find string terminator "'" anywhere before EOF at -e line 1." )
>
> The windows command line interpreter (or is it the DOS interpreter) can't
> handle single quotes to quote arguments.
>
> >case 2:
> >
> >perl -e "$a = '111111';print $a"
> >
> >(not working under UNIX and getting
> >syntax error at -e line 1, near "="
> >Execution of -e aborted due to compilation errors. It works under
> >windows 95)
>
> In this case the double quotes work for the windows command interpreter to
> quote the statements, but a typical unix shell will try and interpolate $a
> in the double quotes before passing the result to perl.  Most likely $a
> turns into an empty string.
>
> There are a number of "better shells" for windows, one place to look might
> be http://www.gci-net.com/~users/c/cteeple/windowsntconsole.htp
>
> Hope this helps,
>
> Mike
>
> --
> mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
> http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
> http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
> stok@colltech.com                  |            Collective Technologies (work)





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

Date: Fri, 05 Jun 1998 12:13:31 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How do I get text counter perl script to work???
Message-Id: <3577D2DA.3C4F93E@nortel.co.uk>

adntaylor@my-dejanews.com wrote:

> What the hell is a URI?

Where did you see that?

> Mum, where DO babies com from? (ignore this line if you have no sense of
> humour)

Hmmm...

> <!--exec cgi="/counter.pl"-->

This is in comments?!? Anyway, that doesn't work on all servers. Don't ask me
what you have to set your server to, though. But it's quite probably not a Perl
problem and you should check the documentation of your server.

--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________





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

Date: 5 Jun 1998 13:47:30 GMT
From: Mike West <westmj@esvax.dnet.dupont.com>
Subject: Re: How do I test MacPerl CGI scrips using my local Browser.
Message-Id: <6l8sti$1mc@topgun.es.dupont.com>

In article <35776C0D.60EE@snet.net> , david.clark@snet.net writes:

>I have just started learning Perl and I have found the MacPerl to be a
>great tool.  Im very much interested in CGI scripts but I want to test
>them Using my Netscape or Explorer browsers to see them work. 

First, of course, see your FAQs in MacPerl and CPAN...

But, I do this two ways:  

*  test at the "command line" that the script works... if I recall
  CGI.pm has good, advanced ways of doing this which I do not use ;-(
  
*  use a web server which you have access to...
  
  since you are using MacPerl, I assume your script is MacPerl and 
  you run a Mac.  Set up your own web server on that Mac; for example
  the excellent shareware NetPresenz or a demo copy of WebStar or 
  whatever, then use it's CGI capability with MacPerl
  
  when you are connected to the internet by PPP, you can use that
  url; or you can use a loopback sort of connection if you are not
  connected to the internet... see the relevant documentation
  
Good resources:

Pudge's page (I expect to see his reply to your question soon...)
http://pudge.net/macperl/

The MacPerl mailing list archive:
http://www.binary.net/dturley/macperl/search.html

Regards, Mike West


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

Date: Fri, 05 Jun 1998 12:51:11 GMT
From: Eadmund@writeme.com
Subject: HTML to PERL translation Conversion
Message-Id: <6l8pjv$m3a$1@nnrp1.dejanews.com>

Hi all,

I'm a bit of a newbie with regard to Perl, HTML, Newsgroups so please don't
flame me if I'm asking a stupid question or posing it to the wrong newsgroup.

I have put together some pretty daunting web pages using notepad and MS-
Frontpage. I now want (for various reasons) to have a Perl script generate
the same HTML code with various forms etc filled in by my web server. I know
that the filling in the data bit will have to be coded in to Perl script by
hand, but....

MY QUESTION: Is there a program/tool that will convert an HTML page into perl
script automatically, to remove the greater part of the donkey work?

If anyone can help - please e-mail me at Eadmund@writeme.com

Ta
     Ed.



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 05 Jun 1998 14:21:05 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: HTML to PERL translation Conversion
Message-Id: <3577F0C0.308CF8AF@nortel.co.uk>

Eadmund@writeme.com wrote:

> Hi all,
>

 ...

> MY QUESTION: Is there a program/tool that will convert an HTML page into perl
> script automatically, to remove the greater part of the donkey work?

# Read html_file, and print to web browserprint "Content-type:text/html";
open(HTML,"< $html_file") || die "Cannot open $html_file:$!";
  while (<HTML>) {
     print $_;
   }
close (HTML);

Something like that?

Or, if you want to strip the html tags from your original html file, so that you
can play around with the text: html::parser from CPAN.


--
____________________________________________________________
Frank Quednau
http://www.surrey.ac.uk/~me51fq
________________________________________________





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

Date: Fri, 05 Jun 1998 13:33:29 GMT
From: rob@frii.com (Rob Greenbank)
Subject: Re: Incrementing zero-padded numbers
Message-Id: <3577f018.86156937@news.frii.com>

The only gotcha here is you do have to be careful how "$theno" is
used.  If you use it somewhere else in a numeric context, you lose the
leading zeros.  Example:
    #!/usr/local/bin/perl
    $theno = "0001";
    for(1 ... 10)
    {
        $out = $theno++;
        $messitup = $theno+1;
        print $out,"\n";
    }
The output from this is:
    0001
    0002
    3
    4
    (etc.)

This isn't a bug -- just the way it works.  It can cause headaches for
those not careful about it.  The reason the second value has leading
zeros is the post-increment had already established it's value before
the numeric reference.  If yoy change it to a pre-increment the 2nd
value loses the zeros.

	Rob Greenbank

On Wed, 03 Jun 1998 19:38:03 GMT, Gellyfish@btinternet.com (Jonathan
Stowe) wrote:

(clip)
>But wait ! Whats this:
>
>#!perl
>$theno = "0001";
>for(1 ... 10)
>{
>   $out = $theno++;
>   print $out,"\n";
>}
>
>Magical autoincrement !!
>
>/J\
>Jonathan Stowe
>Some of your questions answered:
><URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>




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

Date: 5 Jun 1998 14:26:40 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Is PERL case sensitive?
Message-Id: <6l8v70$i32@news-central.tiac.net>

In article <6l7h8k$ms8$3@comdyn.comdyn.com.au>,
Martien Verbruggen <mgjv@comdyn.com.au> wrote:

>It is perl for the program, Perl for the language. Never PERL. 

What if I'm being almost conventional when using the acronym for
Pathologically Eclectic Rubbish Lister?  Or shouting out BUT I LIKE PERL?

Mike


-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 05 Jun 1998 14:49:32 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Is PERL case sensitive?
Message-Id: <3578071B.5766@min.net>

Subject: Is PERL case sensitive?

Yes, it should be "Perl" or "perl" (depending on metaphysical factors).

John Porter


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

Date: Fri, 05 Jun 1998 14:52:17 GMT
From: John Porter <jdporter@min.net>
Subject: No, It's Not (was Re: Yes, it is)
Message-Id: <357807C0.4617@min.net>

Marc Day wrote:
> 
> But then I have a lot of these messages on newgruops I help out.

And I sincerely hope clpm isn't one of them.

John Porter


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

Date: 05 Jun 1998 12:44:23 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: numeric $value to string
Message-Id: <1998060512442300.IAA28117@ladder03.news.aol.com>

Hi Johan:

>For example, rand (1) returns something as 0.2535464646 and
>I'd like not to take the first two characters:
>
> $nmbr = rand(1);

$s_nmbr = sprintf "%12.10f", $nmbr;

> substr($nmbr, 0, 2)= "";

And, of course, $s_nmbr in the subst.

-bill 

Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Fri, 05 Jun 1998 14:28:37 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: numeric $value to string
Message-Id: <6l8val$u39$1@nnrp1.dejanews.com>

In article <3577C6EE.1E8FCBB3@iname.com>,
  Johan Priwshy <Centollo@iname.com> wrote:

[snip]
>
> The problem is I want a string containing some other joined
> strings, ending with some random numbers.
> I use the substr function to take only the not integer part
> of a random number generated with rand ().
>
> For example, rand (1) returns something as 0.2535464646 and
> I'd like not to take the first two characters:
>
>  $nmbr = rand(1);
>  substr($nmbr, 0, 2)= "";
>
> but THIS do not work! Can something explain me how to do this??
>
[snip]

Why do you say it doesn't work? I added a couple of lines to your code, and it
seems to work for me:

# your original code

$nmbr = rand(1);
substr($nmbr, 0, 2)= "";

# new stuff

$mystring = "text_here";
$join_them = $mystring.$nmbr;
print "$join_them\n";

This prints out text_here2535464646 , given the random part you provided
above. Is this not what you want? Can you elaborate further?

Patrick Timmins
U. Nebraska Medical Center



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 4 Jun 1998 01:17:29 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: Perl DBI + Postgres?
Message-Id: <slrn6nbtu9.7mt.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Nick Carter <ap874@torfree.net> wrote :
# Hello,
# 
# Does anyone have experience with running Perl DBI as an interface to the
# Postgres RDBMS?  I can get Postgres running fine by itself, but for some
# reason, when I try to use Perl's DBI to talk to it, I am not getting too
# much luck.  Basically I get errors when I do a call such as:
# 
# DBI->install_driver("Pg"); or
# DBI->connect(..., ..., ...);
# 
# Talking of Postgres, is it worth wasting my time with it? or should I just
# get Oracle instead?
# 
# I would appreciate any email from you regarding your opinion/pointers, helps.

I am working with Postgres and Perl DBI right now on a project.  I
have had zero problems.  The reason I went with DBI is that the real
system will eventually use Oracle, and I can make the switch with
ease, I hope. :)

Postgres in my opinion is stable and solid.  It's quite close to full
SQL92 compliance and every release gets closer.  For a small, free
database it's fantastic.

gabor.
--
    Although the Perl Slogan is There's More Than One Way to Do It, I
    hesitate to make 10 ways to do something.  :-)
        -- Larry Wall in <9695@jpl-devvax.JPL.NASA.GOV>


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

Date: Fri, 05 Jun 1998 19:55:05 +0900
From: Ghim Soo Joong <ghimsj@apwinc.sookmyung.ac.kr>
Subject: Perl Intepreter for Solaris
Message-Id: <3577CE89.7CEB5E6A@apwinc.sookmyung.ac.kr>

Hi, there

Where can I get the "Perl Intepreter" for Solaris 2.5?

Thank you.



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

Date: Fri, 05 Jun 1998 10:37:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Perl Intepreter for Solaris
Message-Id: <35780290.5E144E@matrox.com>

Ghim Soo Joong wrote:

> Hi, there
>
> Where can I get the "Perl Intepreter" for Solaris 2.5?
>
> Thank you.

 http://www.perl.com

--
Ala Qumsieh             |  No .. not just another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)





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

Date: Fri, 05 Jun 1998 14:30:23 GMT
From: John Porter <jdporter@min.net>
Subject: Re: problem using LWP
Message-Id: <3578029E.6E09@min.net>

Tom Christiansen wrote:
> 
> You don't have a proper shell.  I suggest you find one.

Here's a pointer to one solution, which is rather nice.
It includes bash, and a number of other unix (unix-like)
tools ported to win32.

http://www.cygnus.com/misc/gnu-win32/

hth,
John Porter


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

Date: Fri, 05 Jun 1998 13:13:06 GMT
From: john.kelly@citicorp.com (John Kelly)
Subject: Re: problem using variables for waitfor in telnet module
Message-Id: <3579ebda.891742@news.citicorp.com>

No, I guess not because it works now!
	Thanks

On 4 Jun 1998 20:45:30 GMT, gebis@albrecht.ecn.purdue.edu (Michael J
Gebis) wrote:

>john.kelly@citicorp.com (John Kelly) writes:
>
>}I assign a variable the prompt and do :
>}$rem->waitfor('/$prompt/') or die $rem->errmsg;
>}I get 
>}bad match operator: Variable "$prompt" is not imported at
>}test_telnet_csbill.pl
>}I have tried many variations on this.  Can I pass a variable to this
>}function?  
>
>Was one of the variations:
>#untested purely speculative solution - mjg
>$rem->waitfor("/$prompt/") or die $rem->errmsg;



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

Date: Fri, 05 Jun 1998 14:32:32 +0100
From: "N. Walters" <nw22@le.ac.uk>
Subject: Problem: Perl on Linux
Message-Id: <3577F36F.2B3472C0@le.ac.uk>

Hi ,

When trying to run Perl scripts I get the error message:

Perl warning: setting locale failed for the categories
        LC_CTYPE LC_COLLATE
Perl warning: please check that your locale settings
        LC_ALL = {unset},
        LC_CTYPE = {unset},
        LC_COLLATE = {unset},
        LANG = "us"
are supported and installed on your system
Perl warning: falling back to the "C" locale

Any advice,

Cheers.

--
Neil Walters
http://www.internet-club.com/uk/neil_walters





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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2815
**************************************

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