[17505] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4925 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 19 18:05:40 2000

Date: Sun, 19 Nov 2000 15:05:09 -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: <974675109-v9-i4925@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 19 Nov 2000     Volume: 9 Number: 4925

Today's topics:
    Re: 誠意邀請對Perl有興趣的朋友 <dale@emmons.dontspamme.com>
        Accessing windows terminal server luca_vertua@my-deja.com
    Re: Beginners blues. <johngros@Spam.bigpond.net.au>
    Re: Beginners blues. <johngros@Spam.bigpond.net.au>
    Re: Beginners blues. (Martien Verbruggen)
        Dbase IV to TXT <not@here.nl>
        DBI newbie question <stevie_d38nospam@hotmail.com>
    Re: How to I replace charachter? (Colin Watson)
    Re: How to I replace charachter? <mbudash@sonic.net>
    Re: map/grep (Homer Simpson)
    Re: Net::SMTP error message; <jensluetzen@yahoo.de>
    Re: New to Perl. Question (Tad McClellan)
    Re: New to Perl. Question (Garry Williams)
    Re: perl ftp script question? <Petri_member@newsguy.com>
    Re: Perl List Question (Garry Williams)
    Re: Perl List Question (Homer Simpson)
    Re: Perl List Question <bart.lateur@skynet.be>
        regexp question <andyw2@nospam.btconnect.com>
    Re: regexp question (Martien Verbruggen)
    Re: sendmail with cgi.pm? xlr6drone@my-deja.com
        Serial Port <toddm@waltz.rahul.net>
        still broken <captmarvil@rcn.com>
    Re: System command, limit on number of ARGV? (Martien Verbruggen)
    Re: views and/or cursors with DBD::mysql ?? <stevie_d38nospam@hotmail.com>
    Re: views and/or cursors with DBD::mysql ?? <stevie_d38nospam@hotmail.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 19 Nov 2000 15:42:06 -0600
From: "Dale Emmons" <dale@emmons.dontspamme.com>
Subject: Re: 誠意邀請對Perl有興趣的朋友
Message-Id: <t1gis1h216l18a@corp.supernews.com>

"vic" <vicschanweb@hotmail.com> wrote in message
news:8v91tv$8502@rain.i-cable.com...
> 誠意邀請對Perl有興趣的朋友
> http://easy4u.virtualave.net/
> 本站開設Perl論壇,
> 誠意邀請對Perl有興趣的朋友
> 或有問題的朋友到本站發表問題,
>
> 本站Perl論壇採用最方便快捷機制系統:
>
> 1>當有回覆時第一時間把回應送到您的email中
>
> 2>如果你嫌Check email 煩的話,可以引用ICQ回覆的
> 最新係統!
>
> 而且收集很多有關Perl/CGI的文章,絕對是學Perl或增強
> Perl資訊的一流網站!
>
> http://easy4u.virtualave.net/
> 有使每位對Perl/CGI得到完滿的答覆是本站的目標!
>

what a coincidence, that's exactly what I was thinking!

please, this is an english list. post in english.




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

Date: Sun, 19 Nov 2000 20:44:37 GMT
From: luca_vertua@my-deja.com
Subject: Accessing windows terminal server
Message-Id: <8v9e3k$sn3$1@nnrp1.deja.com>

Hi, I need to retrive data using a windows terminal server connection,
perl may act as a client or may use some microsoft library to "emulate"
client.    Any idea will be appreciated.
Luke


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 19 Nov 2000 22:29:20 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners blues.
Message-Id: <4vYR5.13437$tU2.114219@news-server.bigpond.net.au>

my($pwd)= my($time);





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

Date: Sun, 19 Nov 2000 22:33:49 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Beginners blues.
Message-Id: <hzYR5.13439$tU2.113908@news-server.bigpond.net.au>

Thanks Wyzelli, I took the hint and fixed my use of "time". It worked.
In fact I have to thank all who put in some input.




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

Date: Sun, 19 Nov 2000 22:52:11 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Beginners blues.
Message-Id: <slrn91gmbu.q2.mgjv@verbruggen.comdyn.com.au>

[Please, provide some quoted context for the stuff you reply to. It
makes life so much easier on people trying to follow all this.]

Wyzelli said:

>> uninitialised means no value.  How are you setting the value of $pwd?

On Sun, 19 Nov 2000 22:29:20 GMT,
	John Boy Walton <johngros@Spam.bigpond.net.au> wrote:
> my($pwd)= my($time);

What is the relationship between $pwd and $time? Maybe you should
choose better variable names.

Both $pwd and $time are lexically scoped variables, initialised to be
undefined. You have to assign a real value to them. All you have done
is declare them, and wasted CPU cycles on assigning the undefined
value of my($time) to $pwd.

Just post the whole code, if it isn't too large, and explain what it
is you think that line should be doing. All it is doing now would be
better written as

my ($pwd, $time);

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Sun, 19 Nov 2000 22:13:24 +0100
From: Louis <not@here.nl>
Subject: Dbase IV to TXT
Message-Id: <gdgg1ts06evnmuhf876f09809uclanknr3@4ax.com>

Hi all,

I found this PERL script on the net.
Can someone point me to a script that convert a dbase IV file to a TAB
seperate text file? 
Or can someone adjust this script for me???

Louis van Eijk
lveijk@kabelfoon.nl




#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 09/25/1993 10:38 UTC by polleke@triton
# Source directory /user/div/polleke/db3
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2226 -rw-rw-r-- db3.pl
#    763 -rwxrwxr-x db3flat
#
# ============= db3.pl ==============
if test -f 'db3.pl' -a X"$1" != X"-c"; then
	echo 'x - skipping db3.pl (File already exists)'
else
echo 'x - extracting db3.pl (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'db3.pl' &&
X# db3.pl -- routines to read dBaseIII-files
X# (c) 1992 Paul Bijnens
X
X
Xpackage db3;
X
X
X# initialise db3-structures from header of the file
X# usage: db3init(FH);
Xsub main'db3init {
X    local(*Db3) = shift(@_);
X    local($rec, $pos);
X
X    seek(Db3, 0, 0);
X    read(Db3, $rec, 32);
X    $db3version = &endian(substr($rec,0,1));
X    $db3totrec  = &endian(substr($rec,4,4));
X    $db3lenhead = &endian(substr($rec,8,2)) - 1;
X    $db3lenrec  = &endian(substr($rec,10,2));
X
X    if ($db3version == 0x83) {
X	warn("Cannot handle memo-fields\n");
X    } elsif ($db3version != 0x03) {
X	warn("Not a db3-file\n");
X	return 0;
X    }
X
X    $db3nf = $[;
X    $db3fmt = "a1";
X    for ($pos = 32; $pos < $db3lenhead; $pos += 32) {
X	read(Db3, $rec, 32);
X	$db3fn[$db3nf] = unpack("A11", $rec);
X	$db3fn[$db3nf] =~ s/\000.*//;	# sometimes trailing
garbage!!!
X	$db3ft[$db3nf] = substr($rec,11,1);
X	$db3fl[$db3nf] = &endian(substr($rec,16,2));
X	$db3fi{$db3fn[$db3nf]} = $db3nf;	# name -> field index
X	$db3fmt .= "A$db3fl[$db3nf]";
X	#if ($db3ft[$db3nf] eq "C") {
X	#    $db3fmt .= "a$db3fl[$db3nf]";
X	#} elsif ($db3ft[$db3nf] eq "N") {
X	#    $db3fmt .= "A$db3fl[$db3nf]";
X	#}
X	$db3nf++;
X    }
X
X    if (($c = getc(Db3)) != "\r") {
X	print "Header korrupt...\n";
X    }
X    1;
X}
X
X
X# read the next record in the db3-file
X# usage:  db3read(FH)
X# return: list of fields, or () on eof or error;
Xsub main'db3read {
X    local(*Db3) = shift(@_);
X    local($rec, $del, @res);
X
X    do {
X	read(Db3, $rec, $db3lenrec)  ||  return ();
X	($del, @res) = unpack($db3fmt, $rec);
X    } while ($del ne " ");
X    return @res;
X}
X
X
X# print db3-record in flatfile-record format
X# usage: db3_flat_str
Xsub main'db3_flat_str {
X    local($,) = "\t";
X    local($\) = "\n";
X
X    print @db3fn;
X    print @db3fl;
X    print @db3ft;
X}
X
X
X# convert to flatfile-like database
X# usage: db3_flat(DBHANDLE)
Xsub main'db3_flat {
X    local(*Db3) = shift(@_);
X    local($,) = "\t";
X    local($\) = "\n";
X    local(@flds);
X
X    while (@flds = &main'db3read(*Db3)) {
X	print @flds;
X    }
X}
X
X
X# convert little-endian to native machine order
X# (intel = big-endian  ->  mc68k = big-endian)
X# usage
Xsub endian
X{
X    local($n) = 0;
X    foreach (reverse(split('', $_[0]))) {
X	$n = $n * 256 + ord;
X    }
X    $n;
X}
X
X1;
SHAR_EOF
chmod 0664 db3.pl ||
echo 'restore of db3.pl failed'
Wc_c="`wc -c < 'db3.pl'`"
test 2226 -eq "$Wc_c" ||
	echo 'db3.pl: original size 2226, current size' "c" ||
	echo 'db3.pl: original size 2226, current size' "$Wc_c"
fi
# ============= db3flat ==============
if test -f 'db3flat' -a X"$1" != X"-c"; then
	echo 'x - skipping db3flat (File already exists)'
else
echo 'x - extracting db3flat (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'db3flat' &&
X#!/usr/bin/perl
X
X
X# convert db3-file to a flatfile (ascii-file with records consisting
X# of 1 line, and fields separated by a fieldseparator (tab)
character)
X
Xrequire 'db3.pl';
X
Xforeach $infile (@ARGV) {
X
X    ($basename) = ($infile =~ /(.*)\.dbf$/i);
X    die("$infile: name not like 'name.DBF'\n")  unless $basename;
X
X    open(DB, "< $infile")  ||  die("$infile: cannot open: $!\n");
X    open(OUT, "| repl -t pc2ascii > $basename")  ||
X	    die("$basename: cannot open: $!\n");
X    select(OUT);
X
X    &db3init(*DB)  ||  die("$infile: cannot initialise
db3-format\n");
X
X    &db3_flat_str;		# print out the structure
X    &db3_flat(*DB);		# followed by the records
X
X    close(DB)  ||  die("$infile: close: $!\n");
X    close(OUT)  ||  die("$basename: close: $!\n");
X}
SHAR_EOF
chmod 0775 db3flat ||
echo 'restore of db3flat failed'
Wc_c="`wc -c < 'db3flat'`"
test 763 -eq "$Wc_c" ||
	echo 'db3flat: original size 763, current size' "$Wc_c"
fi
exit 0




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

Date: Sun, 19 Nov 2000 14:28:13 -0600
From: "StevieD" <stevie_d38nospam@hotmail.com>
Subject: DBI newbie question
Message-Id: <RHWR5.181$w33.57082@nnrp1.sbc.net>

Hi - just now writing scripts using DBI module (to MySQL in this case), and
i can't seem to gather any metadata using the DBI commands .... Am i doing
something wrong here?  After connecting:

sub metainfo {
@tables = $dbh->tables;
print "<br>\nAvailable Tables:<br>\n";
foreach $table (@tables) {
   print "$table<br>\n";
}
$response = "Done listing tables<br>\n";
}

It always comes up empty, yet i've got 3 tables, and can return data from
them, etc.

-Steve





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

Date: 19 Nov 2000 20:13:27 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: How to I replace charachter?
Message-Id: <8v9c97$9fe$1@riva.ucam.org>

Edmond Nolan <edmond.nolan@debitel.net> wrote:
>Edmond Nolan wrote:
>> how I do I replace all spaces in a string with underscores?
>>
>> my $test = "a b c";
>>
>> so that $test ends up having "a_b_c"
>
>OK, found it ...
>
>my $space = " ";
>my $underscore = "_";
>$test =~ s/$space/$underscore/;

That doesn't work, since you've forgotten the /g modifier to the
substitution.

In any case, I suggest you try this instead, as it's faster and cleaner:

  $test =~ tr/ /_/;

Then go and read the section on "Quote and Quote-like Operators" in
'perldoc perlop'.

-- 
Colin Watson                                     [cjw44@flatline.org.uk]
"Master," I complained, "the programmer who wrote this code is lazy!
It's a simple bug and yet he's done nothing about it." My Master asked
me, "Why, then, have you not fixed it yourself?" I was then enlightened.


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

Date: Sun, 19 Nov 2000 12:15:51 -0800
From: Michael Budash <mbudash@sonic.net>
Subject: Re: How to I replace charachter?
Message-Id: <mbudash-352EAD.12155119112000@news.pacbell.net>


> > Edmond Nolan wrote:
> >
> > Hi,
> >
> > how I do I replace all spaces in a string with underscores?
> >
> > my $test = "a b c";
> >
> > so that $test ends up having "a_b_c"
> >
>
> In article <3A1803AB.8ED62C78@debitel.net>, Edmond Nolan 
> <edmond.nolan@debitel.net> wrote:
> 
> OK, found it ...
> 
> my $space = " ";
> my $underscore = "_";
> $test =~ s/$space/$underscore/;
> 

close ...

$test =~ s/$space/$underscore/g; # note the 'g' for 'global'

what docs are you using?
-- 
Michael Budash ~~~~~~~~~~ mbudash@sonic.net


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

Date: 19 Nov 2000 19:33:18 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: map/grep
Message-Id: <8v99tu$dr1$0@216.39.130.69>

In article <m1n1eydvcd.fsf@halfdome.holdit.com>, merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>>>>>> "Michael" == Michael Lahr <mlahr@my-deja.com> writes:
>
>Michael> what is the difference between map() and grep()?
>Michael> they have the same syntax, iterate on a list and store a reference of
>Michael> the value in $_
>
>Yes, that's the part that the same.  Look slightly further, and you'll
>see the part that's different. :)
>
>"What's the difference between the US and Canada!?  They both are
>countries, have big regions with localized governments, border both
>the Pacific and the Atlantic, and drive on the right side of the road,
>and have dollars as a currency!"

Oh, NOW I get it.  GREP is metric!



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

Date: Sun, 19 Nov 2000 21:19:35 +0100
From: jens <jensluetzen@yahoo.de>
Subject: Re: Net::SMTP error message;
Message-Id: <3A1835D7.3FAC08FD@yahoo.de>



dtbaker_dejanews@my-deja.com wrote:

> In article <3A17A579.4E7FDAFA@yahoo.de>,
>   jens <jensluetzen@yahoo.de> wrote:
> > Hello all,
> >
> > We have the perl Net::SMTP module running on one of our webservers
> > (Netscape Enterprise 3.6 on NT4.0) and the client wants to have
> messages
> > sent to the SMTP server with the help of this module. It works
> perfectly
> > with the small exception that there is always an error message
> returned
> > after pressing the "send"-button, saying: "system could not find path
> > specified" even though, as mentioned,  the message is actually sent.
> We
> > checked all the environment variables and could not find any mistake,
> we
> > reinstalled perl and SP 6.0 but without any success. We simply don't
> > know where this error message is generated for us to manipulate the
> path
> > that the system is obviously trying to access (however unnecessary for
> > the functioning...).
> > Does anyone have any ideas?
> > Any help is greatly appreciated,
> --------------------
>
> I had a spurious warning message like that until I added the optional
> hello=>'mailhost' to the constructor. try using all the options like
> this:
>
> $smtp = Net::SMTP->new('mail',          # connect to an SMTP server
>                                 Hello => 'mail' ,
>                                 Timeout => 30,
>                                 Debug   => 0,
>                                );
>
> Dan
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

Thanks very much,

I will try it first thing tomorrow morning,

Jens



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

Date: Sun, 19 Nov 2000 13:31:15 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: New to Perl. Question
Message-Id: <slrn91g73j.8as.tadmc@magna.metronet.com>

On Sun, 19 Nov 2000 15:40:02 GMT, Garry Williams <garry@zweb.zvolve.net> wrote:

>If you had enabled warnings, you would already know what one of the
>problems was: 
>
>  Global symbol "$my_count" requires explicit package name at...


That is not a warning message, and it does not come from enabling
warnings.

That is a (fatal) error message, and it comes from enabling
strictures with "use strict".

But the OP should have both of them turned on anyway, then
he would have also gotten a warning message about
"used only once".


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


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

Date: Sun, 19 Nov 2000 19:55:29 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: New to Perl. Question
Message-Id: <ReWR5.1075$xb1.63971@eagle.america.net>

On Sun, 19 Nov 2000 13:31:15 -0500, Tad McClellan <tadmc@metronet.com> wrote:
>On Sun, 19 Nov 2000 15:40:02 GMT, Garry Williams <garry@zweb.zvolve.net> wrote:
>
>>If you had enabled warnings, you would already know what one of the
>>problems was: 
>>
>>  Global symbol "$my_count" requires explicit package name at...
>
>That is not a warning message, and it does not come from enabling
>warnings.
>
>That is a (fatal) error message, and it comes from enabling
>strictures with "use strict".
>
>But the OP should have both of them turned on anyway, then
>he would have also gotten a warning message about
>"used only once".

You are correct, of course...

 ... if only I had copied the *warning* message instead of the result
of adding `use strict;' ...

-- 
Garry Williams


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

Date: 19 Nov 2000 11:03:44 -0800
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: perl ftp script question?
Message-Id: <8v986g09sq@edrn.newsguy.com>

In article <8v91ac$jg7$1@nnrp1.deja.com>, halcali@aol.com says...
> the problem is the script is connecting and uploading, but
> only part of the file... and this is with tiny files @10kb

You are probably sending binary type files in ascii mode.
Ascii mode is the default setting.

Try this:

use Net::FTP;
$ftp = Net::FTP->new("$site");
$ftp->login("anonymous", 'me@here.there');
$ftp->binary(); # We want binary type transfers!
$ftp->cwd("$path");
 ...

You will also want to binmode all your filehandles directly after opening them,
if your system is Win32.


Petri Oksanen



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

Date: Sun, 19 Nov 2000 19:08:02 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: Perl List Question
Message-Id: <myVR5.1071$xb1.63243@eagle.america.net>

On Sun, 19 Nov 2000 12:39:46 -0500, Jtk <jtk@_nospam_jtkconsulting.com> wrote:
>Bob Walton <bwalton@rochester.rr.com> wrote :
>
>>    $Email[$ListPos].=':';
>
>>    @Email=map{$_.':'}@Email;
>
>    Bob thanks for your help, however as with Adam's
>    example these lines are still adding the colon at the
>    front of each item instead of the end of each, so I
>    am right where I started.
>
>    So at it's very simplest form the code reads like this:
>
>open ( InFile, 'email.txt') or die "Can't Open the email.txt file.\n";
>@Email = <InFile>;
>@Email=map{$_.':'}@Email;
>print @Email;
>
>    Any ideas why I can't get this colon added to the end of each
>    item instead of the front of each item?
>
>    With what I posted and with what you posted I get:
Well, it *is* easier to know what's wrong with actual code :-).  

>:Z@aol.com
>:Z@whatever.com
>:Z@anyserver.com

But I bet you didn't really cut and paste that.  I bet you *actually*
got this result instead: 

    $ cat > email.txt
    Z@aol.com
    Z@whatever.com
    Z@anyserver.com
    $ perl x
--> Z@aol.com
    :Z@whatever.com
    :Z@anyserver.com
--> :$ cat x
    #!/usr/local/bin/perl -w
    use strict;
    open (InFile, 'email.txt') or die "Can't Open the email.txt file: $!\n";
    my @Email = <InFile>;
    @Email=map{$_.':'}@Email;
    print @Email;
    $

Notice that the first line prints without a colon (:) anywhere and
that the last line prints without any new line character.  Is that a
hint?

If you are still stumped, consider that, 

    my @Email = <InFile>;

results in an array that contains each line in your input file and
that each line in the file ends with a new line character.  

The statement, 

    @Email=map{$_.':'}@Email;

places a colon *after* the new line character at the end of the string
in each element of @Email.  

I suppose what you really want is, 

    $ cat x
    #!/usr/local/bin/perl -w
    use strict;
    open ( InFile, 'email.txt') or die "Can't Open the email.txt file: $!\n";
    chomp(my @Email = <InFile>);
    @Email = map { "$_:\n" } @Email;
    print @Email;
    $ perl x
    Z@aol.com:
    Z@whatever.com:
    Z@anyserver.com:
    $

Or maybe more straightforward would be, 

    perl -wpe 's/\n/:\n/' email.txt

-- 
Garry Williams


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

Date: 19 Nov 2000 19:51:03 GMT
From: homer.simpson@springfield.nul (Homer Simpson)
Subject: Re: Perl List Question
Message-Id: <8v9av7$dr1$1@216.39.130.69>

Just a guess here... each item ends with a newline char so when you put a 
colon after the newline it prints in front of the next item?

How about
        $foo =~ tr/\n/:/;

to replace the unknown/unwanted newlines with colons?
Or transliterate newline to colon newline if you want to keep them...

In article <t1enul1qdlg602@corp.supernews.com>, "Jtk" 
<jtk@_nospam_jtkconsulting.com> wrote:
>Okay I am stumped.  I have a Perl list and I am trying to add
>stuff to the end of each item in the list.  What I came up with
>is :
>
>@Email[$ListPos] =  @Email[$ListPos] .= ":" ;
>
>Now this adds a colon to the Front on each item
>so does:
>
>@Email[$ListPos] =  @Email[$ListPos] . ":" ;
>
>as well as this:
>
>$Email[$ListPos] =  $Email[$ListPos] . ":" ;
>
>So how can I add this colon to the the end of each item?
>
>TIA
>
>Jtk
>
>
>
>



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

Date: Sun, 19 Nov 2000 20:23:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl List Question
Message-Id: <pmdg1tsuoktpf5op41lg7ecdouo75fnsd7@4ax.com>

Jtk wrote:

>So how can I add this colon to the the end of each item?

	$_ .= ":" foreach @Email;

-- 
	Bart.


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

Date: Sun, 19 Nov 2000 22:28:15 -0000
From: "AndyW" <andyw2@nospam.btconnect.com>
Subject: regexp question
Message-Id: <btYR5.13254$_h.70566@NewsReader>

Hi,

This is probably incredibly simple, but I can't get it working correctly.
I'm not very experienced with regular expressions, so have sympathy.

Basically I'm writing a function which scans in text from a file
line-by-line and prints it out formatted in HTML. However, I want to test
for headings (which are all in capitals) and treat them differently, so, how
do I test for a string which is all uppercase (or at least has no lower case
letters - punctuation, numerals etc are allowed)?

I've tried "/^[^a-z]{length($string)}/" which I understand to mean
"match strlen non-[a-z] characters at the start of the line" but it doesn't
work.

Any ideas?

Andy





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

Date: Sun, 19 Nov 2000 23:04:52 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: regexp question
Message-Id: <slrn91gn3m.q2.mgjv@verbruggen.comdyn.com.au>

On Sun, 19 Nov 2000 22:28:15 -0000,
	AndyW <andyw2@nospam.btconnect.com> wrote:

> so, how do I test for a string which is all uppercase (or at least
> has no lower case letters - punctuation, numerals etc are allowed)?

    require 5.6.0;

    print "lowercase character in '$_'" if /[[:lower:]]/;
or
    print "no lowercase character in '$_'" unless /\p{IsLower}/;

The perlre documentation explains.

If you also want to make sure the string has at least one uppercase
character:

    print "Valid '$_'" if /\p{IsUpper}/ and !/\p{IsLower}/;

> I've tried "/^[^a-z]{length($string)}/" which I understand to mean
> "match strlen non-[a-z] characters at the start of the line" but it doesn't
> work.

If you define 'lowercase character' as anything between a and z
(platform and locale dependent), then you can get away with:

    print "lowercase character in '$_'" if /[a-z]/;

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Sun, 19 Nov 2000 18:55:13 GMT
From: xlr6drone@my-deja.com
Subject: Re: sendmail with cgi.pm?
Message-Id: <8v97mg$o12$1@nnrp1.deja.com>

In article <G48802.D2w@news.muni.cz>,
  adelton@informatics.muni.cz wrote:
> On Sat, 18 Nov 2000 09:19:14 GMT, xlr6drone@my-deja.com <
xlr6drone@my-deja.com> wrote:
> > I am using a guestbook script with cgi.pm but I am unable to
get
> > the sendmail program to work.  I want the users inputted data
to
> > be sent to an email address.  The sendmail function is at the
> > bottom of my code.  It has worked with other scripts but
obviously
> > cgi.pm works differently in this area.  Would I have to use the
> > param() in order to use the variables in the sendmail
program?  If
> > so how would this be done?  Any suggestions would be
> > appreciated.
>
> [ long code snipped ]
>
> > open (MAIL, "|/usr/lib/sendmail -t") || &ErrorMessage("error
> > opening sendmail");
> >
> > print MAIL "To: lex\@mindspring.com\n";
> > print MAIL "From: test\@mail.com\n";
> > print MAIL "Subject: $subject\n\n";
> > print MAIL "$location\n\n";
> >
> > close (MAIL);
>
> What doesn't work? What doesn't it do that you'd like it to do?
Does
> the open open at all? What's the return status of close? What if
you
> redirect 2> to some error log file?
>
> --
> ------------------------------------------------------------------------
>  Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/
~adelton/

-------------------------------------------------
There is nothing  in the server error logs.  I don't know how to
redirect to an error log file.

The script prints the user input to a guestbook.txt file but it never
sends the email  with the  variables to my address below.  No
errors appear in the browser either.



print MAIL "To: lexmesa\@mindspring.com\n";
print MAIL "From: test@\mail.com\n";
print MAIL "Subject: $subject\n\n";
print MAIL "$location\n\n";


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 19 Nov 2000 21:32:22 GMT
From: Todd McLaughlin <toddm@waltz.rahul.net>
Subject: Serial Port
Message-Id: <8v9gt6$ffq$1@samba.rahul.net>

Got the following code out of the Perl FAQ:

open( SERIAL_PORT, "+>com1" ) or die "Can't open COM1: $!";
print( $send );
close( SERIAL_PORT );

How do I set the baud rate, parity, and other parameters of the com port?
I'm using Win2K.  From the command line, I can use the mode command.  Can
I do this with Perl?

What does the + symbol indicate in the open command?  I know the > is write
access.

Todd


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

Date: Sun, 19 Nov 2000 14:23:46 -0500
From: "David Marvil" <captmarvil@rcn.com>
Subject: still broken
Message-Id: <8v999v$nd7$1@bob.news.rcn.net>

I hope I am not posting improperly by posting this issue again. If I am I
appologize.

I am still having difficulty in getting this script to work. I can't get any
values to print using eq if I use = I can get a value for $user but I can't
get a value for $a. I am not sure if I am am supposed to have a $ in front
of
name on line 11, I have tried both with and without. I have also moved the
the quotes around. Thanks.

"Wyzelli" <wyzelli@yahoo.com> wrote in message
news:yZGR5.6$dm1.2290@vic.nntp.telstra.net...
> "David Marvil" <captmarvil@rcn.com> wrote in message
> news:8v75dn$jba$1@bob.news.rcn.net...
> > #! /usr/bin/perl -w
> > print "Enter users name: ";
> > chomp  ($user = <STDIN>);
> > open (FILE, "/user_info") || die "File not found";
> > while (<FILE>) {
> > chomp;
> > ($name, $ip) = /(\w+\s+\w+)\s+(\d+\.\d+\.\d+\.\d+)/;
> > $a{$name} = $ip;
> > }
>
> if ($name eq $user){
>     print "$user\t"$a{name};
> }
>
> Hope that helps
>
> Wyzelli
> --
> #Modified from the original by Jim Menard
> for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
> wall,\n";
> print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
> $_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
> wall\n\n";}print'*burp*';
>
>





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

Date: Sun, 19 Nov 2000 21:50:35 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: System command, limit on number of ARGV?
Message-Id: <slrn91giod.q2.mgjv@verbruggen.comdyn.com.au>

On Sun, 19 Nov 2000 15:14:02 GMT,
	dtbaker_dejanews@my-deja.com <dtbaker_dejanews@my-deja.com> wrote:
> 
> I think I'll have to change the logic to write a temp file.... ;(

I'd actually have a look at Abe's suggestion. I think it's the most
elegant of the lot.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Sun, 19 Nov 2000 14:24:41 -0600
From: "StevieD" <stevie_d38nospam@hotmail.com>
Subject: Re: views and/or cursors with DBD::mysql ??
Message-Id: <yEWR5.180$w33.55715@nnrp1.sbc.net>

Thanks, Kurt ... Right you are ... I don't have telnet access, but
determined my version is 3.22.21 ...

-Steve

"Kurt Stephens" <kstep@pepsdesign.com> wrote in message
news:8v7ft2$n3r$1@slb2.atl.mindspring.net...
> "StevieD" <stevie_d38nospam@hotmail.com> wrote in message
> news:tTGR5.334$Uj7.145845@nnrp2.sbc.net...
> > 1) MySQL is all i have to work with at this point, and i'm finding ways
to
> > accomplish what i need in the documentation. These are specific
> workarounds
> > for SQL functionality currently lacking in MySQL.  However, when i use
> Perl
> > to send any of these through DBI and DBD::mysql, it's as if anything
> > proprietary to MySQL's flavor of SQL causes a syntax error in the DBD
> driver
> > (a CREATE TABLE as per mySQL docs in this case):
> >
> > DBD::mysql::db do failed: You have an error in your SQL syntax near
> > 'TEMPORARY TABLE IF NOT EXISTS temp1 SELECT * FROM testTable' at line 1
at
> > mysql_test.pl line 29.
>
> If you check the docs on MySQL CREATE TABLE, the TEMPORARY keyword doesn't
> appear until version 3.23.  I suspect that your problem may not be with
DBI,
> but with an earlier version of MySQL.  If you have Telnet access to the
> server, type the following at the command prompt:
>
> mysql --version
>
> If the version is under 3.23, the TEMPORARY TABLE IF NOT EXISTS syntax
will
> have to go.  You can always add a DROP TABLE when you're done with it.
>
>
>
>




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

Date: Sun, 19 Nov 2000 14:35:32 -0600
From: "StevieD" <stevie_d38nospam@hotmail.com>
Subject: Re: views and/or cursors with DBD::mysql ??
Message-Id: <JOWR5.182$w33.58667@nnrp1.sbc.net>

"Kurt Stephens" <kstep@pepsdesign.com> wrote in message
news:8v7ft2$n3r$1@slb2.atl.mindspring.net...
> If the version is under 3.23, the TEMPORARY TABLE IF NOT EXISTS syntax
will
> have to go.  You can always add a DROP TABLE when you're done with it.

Which creates another issue i'm not sure about: Is there a way using DBI to
check whether a table exists or not before DROPing it? If i don't DROP
before CREATEing my table each time i see problems .....

-Steve





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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4925
**************************************


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