[23388] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5607 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 3 03:05:49 2003

Date: Fri, 3 Oct 2003 00:05:09 -0700 (PDT)
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, 3 Oct 2003     Volume: 10 Number: 5607

Today's topics:
        ANNOUNCE:  Data-Presenter-0.63 <nospam_for_jkeen@concentric.net>
        DBD::Pg and bind_param <cschadl@satan.blah.org.uk>
    Re: DBD::Pg and bind_param <mbudash@sonic.net>
    Re: Free Windows NNTP Server for Perl to post? (Tad McClellan)
    Re: GD::Graph: "mixed" graph doesn't recognize "area" g <mgjv@tradingpost.com.au>
    Re: hashes (John Carroll)
    Re: hashes <mbudash@sonic.net>
    Re: hashes (Tad McClellan)
    Re: hashes (Tad McClellan)
    Re: hashes (Charles DeRykus)
    Re: I would like to use unsupported variant type VT_I8  (Jay Tilton)
        javascript in HTML ... not running on some browsers (Gaurav)
        Problem installing Net::SSLeay <fernando.alvarez-uria@ESTONOhispalinux.es>
    Re: regex for URL in a log file <florian265@uboot.com>
    Re: regex for URL in a log file (Tad McClellan)
        Regex with modifiers in variable? <BLOCKSPAMfishfry@your-mailbox.com>
    Re: Regex with modifiers in variable? <noreply@gunnar.cc>
    Re: Regex with modifiers in variable? <ddunham@redwood.taos.com>
    Re: Regex with modifiers in variable? <invalid-email@rochester.rr.com>
    Re: Regex with modifiers in variable? <BLOCKSPAMfishfry@your-mailbox.com>
    Re: syntax question <ebohlman@earthlink.net>
    Re: Working with a line of text ??? <ebohlman@earthlink.net>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 2 Oct 2003 21:51:06 GMT
From: "James E Keenan" <nospam_for_jkeen@concentric.net>
Subject: ANNOUNCE:  Data-Presenter-0.63
Message-Id: <HM5w1q.10Gq@zorch.sf-bay.org>

A new version of Perl extension Data::Presenter was uploaded to CPAN.
It is available at
http://search.cpan.org/author/JKEENAN/Data-Presenter-0.63/ and at CPAN
mirrors.

Data::Presenter is a modest module useful for re-formatting database reports
and can be used as a small database in situations where one elects not to
use a dedicated database program.






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

Date: Thu, 02 Oct 2003 22:43:47 -0500
From: "Chris Schadl" <cschadl@satan.blah.org.uk>
Subject: DBD::Pg and bind_param
Message-Id: <pan.2003.10.03.03.43.33.810692@satan.blah.org.uk>

Hi,

I'm having some issues getting bind_param to work correcty with DBD::Pg. 
I've written the following code to insert a bunch of mp3 information into
my postgres database using a stored procedure:

#!/usr/bin/perl

use strict;

use DBI qw(:sql_types);
use DBD::Pg qw(:pg_types);
use File::Find;
use MP3::Info qw(:all);

my $dbh;
my $sth;

my ($host, $user, $pass);

$host = 'dbhost';
$user = 'chris';
$pass = '';

@ARGV = qw(.) unless @ARGV;

if (($dbh = DBI->connect(
        "DBI:Pg:dbname=mp3s;host=$host", $user, $pass,
        {RaiseError => 1, AutoCommit => 1})) == undef) {
    print DBI->errstr;
    exit(1);
}

if (($sth = $dbh->prepare("SELECT insert_mp3(?,?,?,?,?,?,?,?,?,?,?,?,?)")) == undef) {
    print $dbh::errstr;
    exit(1);
}

find(\&mp3_insert, $ARGV[0]);

$sth->finish();
$dbh->disconnect();

sub mp3_insert {
    my ($track, $tn, $album, $genre, $year, $label, $artist, $time);
    if (/.mp3/) { # We only want to mess with mp3 files
	
	# Extract mp3 tags/info from file...
	# <snipped>

	$sth->bind_param(1, $track, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(2, $time, SQL_SMALLINT) or die $sth->errstr;
        $sth->bind_param(3, $info->{BITRATE}, {pg_type => PG_BOOL}) or die $sth->errstr;
        $sth->bind_param(4, $info->{VBR}, {pg_type => PG_BOOL}) or die $sth->errstr;
        $sth->bind_param(5, $info->{STEREO}, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(6, $_, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(7, $md5, SQL_CHAR) or die $sth->errstr;
        $sth->bind_param(8, $tn, SQL_SMALLINT) or die $sth->errstr;
        $sth->bind_param(9, $album, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(10, $genre, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(11, $year, SQL_CHAR) or die $sth->errstr;
        $sth->bind_param(12, $label, SQL_VARCHAR) or die $sth->errstr;
        $sth->bind_param(13, $artist, SQL_VARCHAR) or die $sth->errstr;

	$sth->execute;

        while (my $aref = $sth->fetchrow_arrayref()) {
            my @cols = @{$sth->{NAME}};
            for my $i (0..$#cols) {
                print "$cols[$i] => $aref->[$i]\n";
            }
        }
    } else {
        print "$File::Find::name is not an mp3 file.  Skipping...\n";
    }
}

However, when I recieve the following error when I try to run the code:

chris@eclair:~/src/perl/sql$ ./mp3-insert.pl /export/mp3/mp3-X/Pixies\ -\ Trompe\ Le\ Monde/
 ...
DBD::Pg::st execute failed: ERROR:  Function 'insert_mp3(unknown, int4, int4, int4, int4, unknown, unknown, int4, unknown, unknown, unknown, unknown, unknown)' does not exist at ./mp3-insert.pl line 129.
DBD::Pg::st execute failed: ERROR:  Function 'insert_mp3(unknown, int4, int4, int4, int4, unknown, unknown, int4, unknown, unknown, unknown, unknown, unknown)' does not exist at ./mp3-insert.pl line 129.

This is exactly the same error that I would recieve if I had simply called
$sth->execute() with the given variables as arguments rather than passing
them implicitly with bind_param.  Does anyone know what I'm doing wrong?

Thanks,

Chris Schadl


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

Date: Fri, 03 Oct 2003 04:16:49 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: DBD::Pg and bind_param
Message-Id: <mbudash-C18CF0.21164902102003@typhoon.sonic.net>

In article <pan.2003.10.03.03.43.33.810692@satan.blah.org.uk>,
 "Chris Schadl" <cschadl@satan.blah.org.uk> wrote:

> Hi,
> 
> I'm having some issues getting bind_param to work correcty with DBD::Pg. 
> I've written the following code to insert a bunch of mp3 information into
> my postgres database using a stored procedure:
> 
> #!/usr/bin/perl
> 
> use strict;
> 
> use DBI qw(:sql_types);
> use DBD::Pg qw(:pg_types);
> use File::Find;
> use MP3::Info qw(:all);
> 
> my $dbh;
> my $sth;
> 
> my ($host, $user, $pass);
> 
> $host = 'dbhost';
> $user = 'chris';
> $pass = '';
> 
> @ARGV = qw(.) unless @ARGV;
> 
> if (($dbh = DBI->connect(
>         "DBI:Pg:dbname=mp3s;host=$host", $user, $pass,
>         {RaiseError => 1, AutoCommit => 1})) == undef) {
>     print DBI->errstr;
>     exit(1);
> }
> 
> if (($sth = $dbh->prepare("SELECT insert_mp3(?,?,?,?,?,?,?,?,?,?,?,?,?)")) == 
> undef) {

admittedly i know little about postgresql, but what is 'insert_mp3'?
-- 
Michael Budash


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

Date: Thu, 2 Oct 2003 19:29:24 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Free Windows NNTP Server for Perl to post?
Message-Id: <slrnbnpgn4.uq.tadmc@magna.augustmail.com>

Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote:

> Isn't NNTP like mail replay? 


No, SMTP and NNTP operate differently, that's why they
are different protocols.


> As long as I have my own NNTP server, I
> can get into the server-to-server communication.


Why do you need server-to-server NNTP?


> There are many free NNTP for read, but very few open to post.


Because they would be used by spammers to post advertisements.


> As I understand the NNTP in Perl needs a server to post. 


Perl has nothing to do with it.

You need access to an NNTP server regardless of your choice of
programming language if you want to post.


> I want to
> know how I can get this kind of server 


The usual way is to pay for it.

Most ISPs provide news access.


> so that I can use perl to post
> to my own server then the server transfers the file to the central
> database of newsgroup.


Sounds like you want leafnode. Works great, I've used it for years:

    www.leafnode.org

You will still need a "real" server for leafnode to talk to though...


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


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

Date: Fri, 3 Oct 2003 15:13:02 +1000
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD::Graph: "mixed" graph doesn't recognize "area" graph type
Message-Id: <slrnbnq1at.d8h.mgjv@martien.heliotrope.home>

On 1 Oct 2003 14:42:42 -0700,
	Emilio Mayorga <e.mayorga@co.snohomish.wa.us> wrote:
> Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnbnk7nn.d8h.mgjv@martien.heliotrope.home>...
>> On 30 Sep 2003 11:55:49 -0700,
>> 	Emilio Mayorga <e.mayorga@co.snohomish.wa.us> wrote:
>> > Hi,
>> > 
>> > I'm using the GD::Graph module to create some graphs (great module,
>> > BTW!). Everything works fine. But in a "mixed" graph, "area" graphs
>> > are not recognized. I get this error message:
>> > [snip] unknown type area, assuming lines at [snip]
>> > I am trying to create a chart with two lines and three area graphs.
>> > The lines work fine. Area graphs work fine when used by themselves
>> > (not in a mixed graph); I wrote a small program to test this.
>> 
>> That's odd. Area charts should work. There's an example (sample61) in
>> the distribution that uses lines, bars, points, area, and linespoints,
>> all in one chart. Where is the code you tried?

> http://www.co.snohomish.wa.us/publicwk/swm/maps/floodwarn2.pl
> You'll find a sample output graph here:
> http://www.co.snohomish.wa.us/publicwk/swm/maps/hydrograph_sens585.png
> The three colored dashed horizontal lines are the ones I'm trying to
> turn into area graphs. Each one of them is specified as a simple set
> of two points, the start and end of the line.

I've had a bit of a look at it, but I can't really see what's wrong with
it (if anything at all). Would it be possible for you to just fill the
$sensorgraph{$sensorid} hashes with some decent values, and then run the
GD::Graph part separately? if you then still see problems, please email
the result to me, because that probably means there is some bug or
oddity that I need to have a look at.

Thanks,
Martien
-- 
                        | 
Martien Verbruggen      | 
                        | The gene pool could use a little chlorine.
                        | 


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

Date: 2 Oct 2003 16:48:44 -0700
From: john.carroll@usap.gov (John Carroll)
Subject: Re: hashes
Message-Id: <6b4da9ff.0310021548.6eef3197@posting.google.com>

Well, after much testing, I have another puzzler (I've kinda given up
on the previous problem, and moved on)...

BTW, I switched to using CGI.pm, in case that was my problem.  And
note that "testing" is what is sent as the password from the web page,
using POST method.

Following one of the previous posts, I do the following:

Code:
$cgi = CGI->new ();
$file_password = "testing";
$password = $cgi->param ("Password");
print "file password: |$file_password|\n";
print "password: |$password|\n";
print $cgi->param('Password');
print "\n";
print "$cgi->param('Password')";
print "\n";

Result:
file_password: |testing|
password: ||
testing
CGI=HASH(0xf296c)->param('Password')

Why does adding double quotes to the print of the hash result change
the output?  And why does $password not seem to get set to the result
of the hash, or get set to an unprintable value (I think these
questions are related)?

thanks,
john


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

Date: Fri, 03 Oct 2003 00:11:43 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: hashes
Message-Id: <mbudash-303A12.17114302102003@typhoon.sonic.net>

In article <6b4da9ff.0310021548.6eef3197@posting.google.com>,
 john.carroll@usap.gov (John Carroll) wrote:

> Well, after much testing, I have another puzzler (I've kinda given up
> on the previous problem, and moved on)...
> 
> BTW, I switched to using CGI.pm, in case that was my problem.  And
> note that "testing" is what is sent as the password from the web page,
> using POST method.
> 
> Following one of the previous posts, I do the following:
> 
> Code:
> $cgi = CGI->new ();
> $file_password = "testing";
> $password = $cgi->param ("Password");
> print "file password: |$file_password|\n";
> print "password: |$password|\n";
> print $cgi->param('Password');
> print "\n";
> print "$cgi->param('Password')";
> print "\n";
> 
> Result:
> file_password: |testing|
> password: ||
> testing
> CGI=HASH(0xf296c)->param('Password')
> 
> Why does adding double quotes to the print of the hash result change
> the output?  

the double quotes around $cgi->param('Password') cause '$cgi' to be 
interpolated (correctly), but not 'param'. this is to be expected: 
variables are interpolated, not methods.

> And why does $password not seem to get set to the result
> of the hash, or get set to an unprintable value (I think these
> questions are related)?

dunno... works for me...
-- 
Michael Budash


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

Date: Thu, 2 Oct 2003 19:36:30 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: hashes
Message-Id: <slrnbnph4e.uq.tadmc@magna.augustmail.com>

John Carroll <john.carroll@usap.gov> wrote:

> print "$cgi->param('Password')";

> CGI=HASH(0xf296c)->param('Password')
> 
> Why does adding double quotes to the print of the hash result change
> the output?  


You can interpolate variables.

You cannot interpolate function (method) calls, without resorting
to the trickery described in this Perl FAQ:

   How do I expand function calls in a string?


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


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

Date: Thu, 2 Oct 2003 19:37:52 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: hashes
Message-Id: <slrnbnph70.uq.tadmc@magna.augustmail.com>

John Carroll <john.carroll@usap.gov> wrote:

> $cgi = CGI->new ();
> $file_password = "testing";
> $password = $cgi->param ("Password");
> print "file password: |$file_password|\n";
> print "password: |$password|\n";
> print $cgi->param('Password');
> print "\n";
> print "$cgi->param('Password')";
> print "\n";


> And why does $password not seem to get set to the result
> of the hash,


What hash?


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


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

Date: Fri, 3 Oct 2003 00:37:54 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: hashes
Message-Id: <HM5oF6.6Ky@news.boeing.com>

In article <6b4da9ff.0310021548.6eef3197@posting.google.com>,
John Carroll <john.carroll@usap.gov> wrote:
>...
>$cgi = CGI->new ();
>$file_password = "testing";
>$password = $cgi->param ("Password");
>print "file password: |$file_password|\n";
>print "password: |$password|\n";
>print $cgi->param('Password');
>print "\n";
>print "$cgi->param('Password')";
>print "\n";
>
>Result:
>file_password: |testing|
>password: ||
>testing
>CGI=HASH(0xf296c)->param('Password')
>
>Why does adding double quotes to the print of the hash result change
>the output?  And why does $password not seem to get set to the result
>of the hash, or get set to an unprintable value (I think these
>questions are related)?
>

Are you sure a Password value is set...

 ./tmp.pl Password=testing
file password: |testing|
password: |testing|
testing
CGI=HASH(0x23204)->param('Password')

hth,
--
Charles DeRykus


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

Date: Fri, 03 Oct 2003 00:09:46 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: I would like to use unsupported variant type VT_I8 and VT_UI4.
Message-Id: <3f7cbe12.257916236@news.erols.com>

grosmezz@yahoo.com (Stephan Meszaros) wrote:

: Hi, I am a newbie with PERL and I writing a script to access some
: ActiveX methods that are using VT_I8 and VT_UI4.
: I have succeeded so far accessing other methods that are using the
: supported types in the Win32::OLE::Variant module.
: 
: How hard would it be to add support for the VT_I8 and VT_UI4 variant
: types?
: Where do I start?

It _might_ be as easy as adding them to the Win32::OLE::Variant module.

    sub VT_UI4 {19;}
    sub VT_I8 {20;}

Or it might require more work.  Try asking ActiveState about it--contact
information is in the Win32::OLE documentation.



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

Date: 2 Oct 2003 23:34:19 -0700
From: bansal2425@hotmail.com (Gaurav)
Subject: javascript in HTML ... not running on some browsers
Message-Id: <42983cb.0310022234.b733498@posting.google.com>

Hello,

i have some java script with in html. It runs fine on IE 6.0 but
doesnt run on some browsers like IE 5.0.

Can someone tell me whats the problem ? And how can i solve it.

here is the url

http://godot.urol.uic.edu/output.html

thank you in advance. 

Gaurav


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

Date: Fri, 03 Oct 2003 05:49:07 +0200
From: Fernando Alvarez-Uria <fernando.alvarez-uria@ESTONOhispalinux.es>
Subject: Problem installing Net::SSLeay
Message-Id: <blirji$bcj$1@news.ya.com>

Hi all!

Im installing Net::SSLeay module from CPAN, and i get this error:

 ...

Spawning a TCP test server on port 1211, pid=23218...
Out of memory!
*** not ok 5tcp
 ...
make test had returned bad status, won't install without force

 ...


Using "force install" should works, but im not sure if it would have bad 
consequences in the future.

What do you recomend me to do?

Thanks a lot.

Fernando Alvarez-Uria
Madrid, Spain



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

Date: 03 Oct 2003 00:41:19 +0200
From: Florian von Savigny <florian265@uboot.com>
Subject: Re: regex for URL in a log file
Message-Id: <m3d6df1cvk.fsf@uboot.com>


Florian von Savigny <florian265@uboot.com> writes:

> However, as this
> seems to return the contents of the first pair of parentheses (all $1,
> so to speak), I wouldn't want to guess what it returns if you use more
> than one pair.

Sorry, got it: it returns What You Would Expect: if you have two pairs
of parentheses, it will return $1, $2, for the first match, then $1,
$2 for the second, and so on. So using more than one pair of
parentheses probably makes your approach unwieldy, as you'd probably
have to post-process your list. 

-- 


Florian v. Savigny

If you are going to reply in private, please be patient, as I only
check for mail something like once a week. - Si vous allez répondre
personellement, patientez s.v.p., car je ne lis les courriels
qu'environ une fois par semaine.


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

Date: Thu, 2 Oct 2003 19:10:41 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: regex for URL in a log file
Message-Id: <slrnbnpfk1.uq.tadmc@magna.augustmail.com>

Florian von Savigny <florian265@uboot.com> wrote:

>   e.g., formulate the body of the URL as "[^\s]+"


or as   \S+   which matches exactly the same characters.


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


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

Date: Thu, 02 Oct 2003 22:05:13 GMT
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: Regex with modifiers in variable?
Message-Id: <BLOCKSPAMfishfry-695275.15051202102003@netnews.attbi.com>

How do I match a regex when the regex is stored in a variable, and has 
modifiers?  Example:

$string = 'abcdefg';
$regex = 'def';

if ($string =~ $regex) {
    print "yes\n";
}

prints "yes".

However 

$string = 'abcdefg';
$regex = 'DEF';

if ($string =~ $regex) {
    print "yes\n";
}

of course does not print yes.

But 

$string = 'abcdefg';
$regex = '/DEF/i';

if ($string =~ $regex) {
    print "yes\n";
}

does not print yes either.

Any suggestions?


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

Date: Fri, 03 Oct 2003 00:13:40 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Regex with modifiers in variable?
Message-Id: <bli7vq$cd433$1@ID-184292.news.uni-berlin.de>

fishfry wrote:
> How do I match a regex when the regex is stored in a variable, and
> has modifiers?  Example:

<snip>

> $string = 'abcdefg';
> $regex = '/DEF/i';
> 
> if ($string =~ $regex) {
>     print "yes\n";
> }
> 
> does not print yes

One way is to move the modifiers, if possible:

     $string = 'abcdefg';
     $regex = 'DEF';

     if ($string =~ /$regex/i) {
         print "yes\n";
     }

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Thu, 02 Oct 2003 22:17:25 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Regex with modifiers in variable?
Message-Id: <Vt1fb.69$tS.8610955@newssvr21.news.prodigy.com>

fishfry <BLOCKSPAMfishfry@your-mailbox.com> wrote:
> How do I match a regex when the regex is stored in a variable, and has 
> modifiers?  Example:

> $string = 'abcdefg';
> $regex = 'def';

Notice this example doesn't have the delimiters around the regex.

> $string = 'abcdefg';
> $regex = '/DEF/i';

But in this one you tried to put them in.

You'll have more luck with embedding the modifier into the regex itself.

% perldoc perlre
[...]
     "(?imsx-imsx)"
               One or more embedded pattern-match modifiers.
[...]
                   $pattern = "foobar";
                   if ( /$pattern/i ) { }

                   # more flexible:

                   $pattern = "(?i)foobar";
                   if ( /$pattern/ ) { }

So for your example, try
$regex = '(?i)DEF';

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: Fri, 03 Oct 2003 00:37:27 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Regex with modifiers in variable?
Message-Id: <3F7CC481.40308@rochester.rr.com>

fishfry wrote:

 ...
> But 
> 
> $string = 'abcdefg';
> $regex = '/DEF/i';


   $regex = qr/DEF/i;


> 
> if ($string =~ $regex) {
>     print "yes\n";
> }
> 
> does not print yes either.
> 
> Any suggestions?


Use the qr// operator to define regexp you wish to assign to scalars. 
That's what it's for.  See:

    perldoc perlop

particularly the section on "Regexp Quote-Like Operators".

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: Fri, 03 Oct 2003 06:15:13 GMT
From: fishfry <BLOCKSPAMfishfry@your-mailbox.com>
Subject: Re: Regex with modifiers in variable?
Message-Id: <BLOCKSPAMfishfry-D2B86C.23151102102003@netnews.attbi.com>

In article <3F7CC481.40308@rochester.rr.com>,
 Bob Walton <invalid-email@rochester.rr.com> wrote:

> fishfry wrote:
> 
> ...
> > But 
> > 
> > $string = 'abcdefg';
> > $regex = '/DEF/i';
> 
> 
>    $regex = qr/DEF/i;
> 
> 
> > 
> > if ($string =~ $regex) {
> >     print "yes\n";
> > }
> > 
> > does not print yes either.
> > 
> > Any suggestions?
> 
> 
> Use the qr// operator to define regexp you wish to assign to scalars. 
> That's what it's for.  See:
> 
>     perldoc perlop
> 
> particularly the section on "Regexp Quote-Like Operators".

Hey that works!! Thanks much.


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

Date: 3 Oct 2003 02:46:00 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: syntax question
Message-Id: <Xns9408DF1705D9Bebohlmanomsdevcom@130.133.1.4>

JS <vervoom@hotmail.com> wrote in news:blgqdr$r3g$1@cspc1n11.baplc.com:

> Here is the code I'm trying to get to work:
> 
> my $firstdept=1;
> foreach my $app (keys %appdept_percentage){
>                  my $applen=length($app)+4;
>                  $firstdept?$firstdept=0,printf "\n%35s",$app:printf 
> "%".$applen."s",$app
> }

The first thing to note is that setting $firstdept to zero can be done 
unconditionally, since it should be zero after you've printed any line.

The second thing to note is that once you've removed the above assignment, 
you're left with two printf's that differ only in their format strings.  
Therefore, you should have one printf with a conditional expression to 
determine the appropriate format string.  I'd write it as:

my $firstdept=1;
foreach my $app (keys %appdept_percentage){
    my $applen=length($app)+4;
    printf $firstdept?"\n%35s":"%${applen}s",$app;
    $firstdept=0;
}


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

Date: 3 Oct 2003 02:15:18 GMT
From: Eric Bohlman <ebohlman@earthlink.net>
Subject: Re: Working with a line of text ???
Message-Id: <Xns9408D9E2B8BF6ebohlmanomsdevcom@130.133.1.4>

"Rodney" <NoSpamPlease@bellsouth.net> wrote in
news:UEHeb.208$wC1.197@bignews3.bellsouth.net: 

> I have a situation where I want to send portions of a line of text to
> a subroutine for processing.  The text line could look like this:
> 
> blah blah <!--Start-- blah blah blah--End--> blah blah blah
> <!--Start-- blah blah--End--> blah blah blah.
> 
> I only want to send the text that is NOT within the <!--Start-- and
> --End--> tags.  So example above would have 3 pieces of text the need
> to run through the subroutine.
> 
> After they go through the subroutine, the line of text needs to be
> regrouped in the same order it was before it was processed and the
> "Tags" have to be in tact.

You might want to take a look at Text::Balanced and see if any of its 
methods would do the trick.


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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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 5607
***************************************


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