[23224] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5444 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 5 00:31:28 2003

Date: Thu, 4 Sep 2003 21: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           Thu, 4 Sep 2003     Volume: 10 Number: 5444

Today's topics:
        [newbie] dbi question <tsheets@insightbb.com>
    Re: [newbie] dbi question <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Brackets () in variable used for pattern match <t18_pilot@hotmail.spam.com>
    Re: Brackets () in variable used for pattern match <postmaster@castleamber.com>
    Re: Formats re-setting top of page format (Jay Tilton)
    Re: GD: Graph Data Array Issue <mgjv@tradingpost.com.au>
    Re: Getting directory sizes on win32 (Jay Tilton)
    Re: Graph Data Array Issue <NOSPAM@bigpond.com>
    Re: Is there a $. equivalent for output? <krahnj@acm.org>
    Re: Is there a $. equivalent for output? <postmaster@castleamber.com>
    Re: Looping scalar and regex'ing it <klubbheads_NO_SPAM@rogers.com>
        LWP::UserAgent->request(https) resets alarm() (jarkun)
        Making a script write to a file (take 2) (Dave)
    Re: Making a script write to a file (take 2) <postmaster@castleamber.com>
    Re: Making a script write to a file (take 2) <laocoon@fastmail.fm>
        Making a script write to a file (Dave)
    Re: Making a script write to a file <uri@stemsystems.com>
        Net::SSH::Perl <jaws@skyinet.net>
    Re: Net::SSH::Perl chesucat@freeshell.org
    Re: Order of evaluation of expressions <bwalton@rochester.rr.com>
    Re: Order of evaluation of expressions (Sam Holden)
        perl  -w  example.pl (Steve Rathkopf)
    Re: perl  -w  example.pl <postmaster@castleamber.com>
    Re: perl  -w  example.pl <bwalton@rochester.rr.com>
    Re: Redirect stdio into a string <pkent77tea@yahoo.com.tea>
    Re: Replacing text - problem with $1 <o0o@shitrit.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 05 Sep 2003 02:44:36 GMT
From: tsheets <tsheets@insightbb.com>
Subject: [newbie] dbi question
Message-Id: <oMS5b.358746$uu5.69953@sccrnsc04>

I am new to perl, and expecially dbi, but am trying to figure the best 
way to accomplish the following:

I have an HTML form, that lets the user select which fields to include 
in the results.  Also, a text box for the where clause.

for example, the table contains firstname, lastname, phone, address, and 
zip.

Lets say you only want firstname, lastname, and zip (checkboxes), where 
lastname = smith.

So far, I have been able to figure out which boxes are checked, and 
store that in a variable to pass to the select statement, and build the 
resulting HTML table with the correct headings.  But, I am not sure how 
to go about processing only the fields selected with the data returned 
from the query.

I have read several examples, and the perldoc, but about the closest 
thing I have understood is getting the entire row, and only printing out 
the interesting fields.  Is this my best bet, or am I just not 
understanding something (like bind_columns maybe)?  The fact that any 
number or combination of boxes can be checked really has me stumped.

I would love to post some code to clarify, but I haven't gotten far 
enough to even do that!!

Also, if there's a more appropriate group, feel free to point me in the 
right direction.

Thanks for your help.

Tim



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

Date: Thu, 4 Sep 2003 20:19:43 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: [newbie] dbi question
Message-Id: <fcv8jb.mc2.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

In article <oMS5b.358746$uu5.69953@sccrnsc04>, tsheets wrote:

> for example, the table contains firstname, lastname, phone, address, and 
> zip.
> 
> Lets say you only want firstname, lastname, and zip (checkboxes), where 
> lastname = smith.
> 
> So far, I have been able to figure out which boxes are checked, and 
> store that in a variable to pass to the select statement, and build the 
> resulting HTML table with the correct headings.  But, I am not sure how 
> to go about processing only the fields selected with the data returned 
> from the query.
> 
> I have read several examples, and the perldoc, but about the closest 
> thing I have understood is getting the entire row, and only printing out 
> the interesting fields.  Is this my best bet, or am I just not 
> understanding something (like bind_columns maybe)?  The fact that any 
> number or combination of boxes can be checked really has me stumped.
> 
> I would love to post some code to clarify, but I haven't gotten far 
> enough to even do that!!

Umm, you must have *some* sort of code if you've figured out the
above.  :)

> Also, if there's a more appropriate group, feel free to point me in the 
> right direction.

There's a dbi mailing list, which IIRC you can subscribe at
dbi.perl.org.  To very quickly answer your question, though,
you'd probably like to construct your select statement to select
only the rows that the user selects.  To continue your example,
your select might be something like

SELECT firstname,lastname,zip FROM tablename WHERE lastname='Smith'

But this is really an SQL question, and not too appropriate for
clpm.  The DBI list might be more appropriate--it's not really
about SQL either, but they can help you decide if there's a more
appropriate way to extract the data you want using Perl.

- --keith

- -- 
kkeller-mmmspam@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj9YAMsACgkQhVcNCxZ5ID9yHwCfV80Nn6NtEdMSu3HIap/GHO9f
zg0AmgJh2t0o9VzyVf9Dufl95iLVFH8R
=P9ki
-----END PGP SIGNATURE-----


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

Date: Fri, 05 Sep 2003 00:20:52 GMT
From: "William Hymen" <t18_pilot@hotmail.spam.com>
Subject: Re: Brackets () in variable used for pattern match
Message-Id: <EFQ5b.32524$Om1.1816@newsread2.news.atl.earthlink.net>

Sorry, never knew there was a rule called top-posting.
I get tired of constantly scrolling to the bottom ;) - Bill

"Thens" <thens@NOSPAMti.com> wrote in message
news:20030903170755.1e0161e6.thens@NOSPAMti.com...
> On 3 Sep 2003 02:09:57 -0700
> dna@888.nu (Marcus Brody) wrote:
>
> >Hi,
> >
> >I'm new to perl and programming, so please please dont throw the
> >manual at me!!
>
>   You will remain a newbie, if you dont develop a liking for the manual
> ;-).
>
>   Manual is the best source of reference, what more it is available in
> your hard disk. What are you waiting for.
>
> perldoc -f <fucntion>
> perldoc -q <keyword>  # faq search
> perldoc perldoc       # to know about the manual
> perldoc perldata      # perl data structures
> perldoc perlre        # Regular expressions
> perldoc perlref       # references
> - more-
>
>   Have fun !!
>
> Regards,
> Thens.
>
>
>




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

Date: Fri, 05 Sep 2003 02:23:14 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Brackets () in variable used for pattern match
Message-Id: <3f57d7d6$0$194$58c7af7e@news.kabelfoon.nl>

William Hymen wrote:

> Sorry, never knew there was a rule called top-posting.

A rule *against*

> I get tired of constantly scrolling to the bottom ;) - Bill

We get tired of scrolling down to understand wtf a top poster is 
replying to. Also We are amazed at the garbage that hasn't been cut out.
Cut pieces no longer needed and you don't have to scroll. And your 
replies will be much more understandable.

BTW tinw

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



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

Date: Thu, 04 Sep 2003 22:10:03 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Formats re-setting top of page format
Message-Id: <3f57b782.170110577@news.erols.com>

Tony <tony1911@hotmail.com> wrote:

: This is a small version that shows the problem.
: If it stays in the while loop it only prints
: the top format the first time around then dosen't
: print the top format for the next sixty odd iterations
: which seems normal but not quite what I need.
: 
: If the program exits and is re-started it does the same
: top only first time around. 
: Each iteration it creates a new tempfile. 
: Tried setting $- = 0; had no effect.

select() the output filehandle before assigning $- = 0;



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

Date: 04 Sep 2003 23:03:51 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: GD: Graph Data Array Issue
Message-Id: <slrnblfh6p.cks.mgjv@verbruggen.comdyn.com.au>

On 4 Sep 2003 08:45:39 -0700,
	Chad Thomson <chad_thomson18@hotmail.com> wrote:
> Hi All.
> 
> I'm relatively new to Perl, and have been somewhat successful using
> the GD::Graph and Graph3d modules.
> 
> I'm using this procedure as a CGI app to generate graphs.
> I've got an issue where, I'm setting up the @data array and when my
> image renders in the browser, it has a width, and height, but still
> appears as a broken link.

Renders in the browser? How do you mean, and what is the URL to the
script below you use?

> I've tried CARP and multiple other techniques to figure out what's
> happening.  Obviously unsuccessful.

Have you also checked the web server logs for error messages?

> use CGI ':standard';
> use GD::Graph::bars3d;
> 
> # Create CGI Object
> my $q = new CGI;
> 
> my $alpha = "abcdefghijklmnopqrstuvwxyz";
> my $ii = 0;
> my $paramname;
> 
> # a sample url would be:
> # ?xlabels=this,that,theother&groups=joe,ed,frank&a=1,2,3&b=4,5,6&c=7,8,9
> 
> # get X labels
> my @labels = [ split (/\,/, $q->param ("xlabels")) ];
> 
> # get data groups
> my @datagroups =  split (/\,/, $q->param("groups"));
> 
> # @data is supplied to the generator @plot-time
> my @data = ( @labels );
> 
> # get data sets
> # data is on query string as: a=1,2,3&b=4,5,6
> my @datasets;
> foreach (@datagroups) {
>   $paramname = substr $alpha, $ii, 1;
>   push @datasets, [ split ( /\,/ , $q->param($paramname) ) ];
>   $ii++;
> }

It looks here like you're use $ii and $alpha to get an alphabetically
incrementing letter, right? Perl's automagical increment can do this
for you:

my $paramname = "a";
foreach my $dg (@datagroups)
{
    push @datasets, [split /,/ , $q->param($paramname)];
    $paramname++;
}

> # @datasets should have a structure like this now.
> # @datasets = ( [ 12,15,20 ]
> #              ,[ 30,10,25 ]
> #              ,[ 15,25,55 ]
> #             );

And the number of labels should be the same as the number of array
references in @datasets here, right?

So, each column here represents a set of data that will become a line
or bar group in the chart?

>=DEBUGcomments
>  need to transpose datasets into @data:
>     @data = ( [ labels ] 
>              ,[ 12,30,15 ]
>              ,[ 15,10,25 ]
>              ,[ 15,25,55 ]
                  ^^
		  20?

>             );
>=cut

[ I wish you hadn't chosen a three-by-three data set. It's easier to
visualise this sort of stuff with non-square sets ]

But, given this, it looks like for each @datagroup, you're reading in
the values for the three data sets that at that point need to be
appended to the sets. The GD::Graph::Data module that prepares data
sets for GD::Graph has an "add_point" method for this.

I'd probably do something like:

use GD::Graph::Data;

my $dataset = GD::Graph::Data->new();

my $paramname = "a";
foreach my $dg (@datagroups)
{
    $dataset->add_point("dummy", split /,/ , $q->param($paramname));
    $paramname++;
}
for my $i (0 .. $#labels)
{
    $dataset->set_x($i, $labels[$i]);
}

And then use $dataset instead of \@data. It's quite easy to lose track
of how to work with those data structures.

> my $my_image = $my_graph->plot(\@data) or die $my_graph->error;

This probably generates an error. Check your web server log.

Alternatively, if you use the fatalsToBrowser argument with CGI, you
should see the error messages in your browser.

> print "Content-type: image/png\n\n";

Use the CGI methods for this, since you've loaded the module anyway.

print $q->header(-type => "image/png");

> binmode ( STDOUT );

You should use the binmode as the first thing you do on STDOUT, before
the above print even.

Without really deconstructing what you did with that data set, I can't
tell whether that is what is wrong. I'd advise you to get check the
GD::Graph::Data module, which can help with this particular structure,
and maybe use Data::Dumper to dump out the structure to your browser,
so you can see what it looks like.

Also, for testing, don't use square data sets. It's much easier to
debug a non-square one.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | Can't say that it is, 'cause it ain't.
                        | 


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

Date: Thu, 04 Sep 2003 22:14:50 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Getting directory sizes on win32
Message-Id: <3f57b8c0.170429161@news.erols.com>

deaduser@hotmail.com (Jeffrey Ellin) wrote:

:         $res = `diruse /m $path`;
: 	@res = split(/\n/,$res);

If you use the backtick operator in list context, the returned results
will be burst into lines for you.

    @res = `diruse /m $path`;

: 	@dirsize = split(/\s+/,@res[3]);
                               ^^^^^^^
Don't use an array slice to get a single array element.  Got warnings
turned on?

    @dirsize = split(/\s+/, $res[3]);

: 	$dirsize = "@dirsize[1]";
                   ^           ^
Don't quote variables when you don't need to, and, again, avoid the
one-element array slice.

    $dirsize = $dirsize[1];

You could boil it all down into a single statement that makes the
intermediate arrays unnecessary.

    $dirsize = ( split /\s+/, (`diruse /m $path`)[3] )[1];
 


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

Date: Fri, 5 Sep 2003 11:23:35 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Graph Data Array Issue
Message-Id: <bj8oj0$gbr2a$1@ID-202028.news.uni-berlin.de>

"Chad Thomson" <chad_thomson18@hotmail.com> wrote in message
news:ebe52c7.0309040745.9e49377@posting.google.com...
> Hi All.
>
> I'm relatively new to Perl, and have been somewhat successful using
> the GD::Graph and Graph3d modules.
>
> I'm using this procedure as a CGI app to generate graphs.
> I've got an issue where, I'm setting up the @data array and when my
> image renders in the browser, it has a width, and height, but still
> appears as a broken link.
>
> I've tried CARP and multiple other techniques to figure out what's
> happening.  Obviously unsuccessful.
>
> I believe the issue is directly related to the @data array, and/or
> it's reference.
>
> I've attached a "scaled-down" snipped of what I'm working with, any
> advice is appreciated.
>
> Chad.

I do the same sort of thing & a superficial look at your code shows no
obvious errors. CARP will not work as you are not generating HTML.

I suggest opening a file (in / tmp if necessary) and writing debugging
messages there. As you have a broken link you may not even be calling the
program.
You can try writing your png file to disk (as 'test.png') instead of stdout
and try to load test.png in the browser.

You might want to look at the HTML I have at www.ipo-australia.com to
generate graphs.

gtoomey




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

Date: Thu, 04 Sep 2003 23:30:28 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Is there a $. equivalent for output?
Message-Id: <3F57CAF9.6A2F720B@acm.org>

John Bokma wrote:
> 
> Is there a $. equivalent for output, ie. current linenumber of output when I
> 
> print FILE "line\n";

No, you are going to have to define your own variable to do this.


John
-- 
use Perl;
program
fulfillment


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

Date: Fri, 05 Sep 2003 02:03:25 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Is there a $. equivalent for output?
Message-Id: <3f57d331$0$193$58c7af7e@news.kabelfoon.nl>

John W. Krahn wrote:

> John Bokma wrote:
> 
>>Is there a $. equivalent for output, ie. current linenumber of output when I
>>
>>print FILE "line\n";
> 
> 
> No, you are going to have to define your own variable to do this.

Was afraid so.

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



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

Date: Fri, 05 Sep 2003 02:54:23 GMT
From: Moltar <klubbheads_NO_SPAM@rogers.com>
Subject: Re: Looping scalar and regex'ing it
Message-Id: <Xns93ECE90CCABD86745413465432435464@66.185.95.104>

Hey your code works fine, but I do not have access to file handler anymore %). As I said, I only have a 
scalar (string) to work with. :(

Thank you for your help.



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

Date: 4 Sep 2003 19:46:43 -0700
From: christophergoebel@yahoo.com (jarkun)
Subject: LWP::UserAgent->request(https) resets alarm()
Message-Id: <16df376.0309041846.42a003fc@posting.google.com>

found a bug in LWP. When calling LWP::UserAgent->request(https) 
any pre-existing alarm() gets reset. Digging around the problem 
appears that the LWP uses NET::SSL.pm as part of the https connection 
and this code uses an alarm() for timeouts

This doesn't happen for plain ol http-style connections, only https

I haven't puzzled out which piece needs to be changed SSL.pm or LWP

This is happening on a redhat9 box with what I believe are all the
latest packages from CPAN

Who do I contact to submit this as a bug report?


Chris Goebel


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

Date: 4 Sep 2003 18:47:55 -0700
From: prometheus_au@excite.com.au (Dave)
Subject: Making a script write to a file (take 2)
Message-Id: <526e114e.0309041747.7f0ec8aa@posting.google.com>

G'day all

I'm trying to get a script to write (append) data to the bottom line
of a text file (*.dat). I know the variables I want to add but can't
do it.
I need to append something that looks like this...

$invoice|$date|Your Order has been received

Any suggestions would be helpful.

Cheers
Dave.


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

Date: Fri, 05 Sep 2003 03:51:59 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Making a script write to a file (take 2)
Message-Id: <3f57eca2$0$183$58c7af7e@news.kabelfoon.nl>

Dave wrote:

> G'day all
> 
> I'm trying to get a script to write (append) data to the bottom line
> of a text file (*.dat). I know the variables I want to add but can't
> do it.
> I need to append something that looks like this...
> 
> $invoice|$date|Your Order has been received
> 
> Any suggestions would be helpful.

Is it possible that multiple processes add at the same time?

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



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

Date: Fri, 5 Sep 2003 04:53:18 +0200
From: Lao Coon <laocoon@fastmail.fm>
Subject: Re: Making a script write to a file (take 2)
Message-Id: <bj8tqu$oso$00$1@news.t-online.com>

prometheus_au@excite.com.au (Dave) wrote in 
news:526e114e.0309041747.7f0ec8aa@posting.google.com:

> G'day all
> 
> I'm trying to get a script to write (append) data to the bottom line
> of a text file (*.dat). I know the variables I want to add but can't
> do it.
> I need to append something that looks like this...
> 
> $invoice|$date|Your Order has been received
> 
> Any suggestions would be helpful.

Read perldoc perlopentut

open OUT, ">> file.dat" or die "Could not open file.dat : $!";

print OUT "$invoice|$date|Your Order has been received\n";

close OUT;



Lao


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

Date: 4 Sep 2003 18:39:18 -0700
From: prometheus_au@excite.com.au (Dave)
Subject: Making a script write to a file
Message-Id: <526e114e.0309041739.2bfac69f@posting.google.com>

G'day all


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

Date: Fri, 05 Sep 2003 01:52:27 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Making a script write to a file
Message-Id: <x7ekywq9wk.fsf@mail.sysarch.com>

>>>>> "D" == Dave  <prometheus_au@excite.com.au> writes:

  D> G'day all 

g'day back.

you can't MAKE a script do anything but you can CODE a script to write
to a file.

and if this is the level of perl skill you have, you should go to
learn.perl.org and read some of the beginner tutorials they have.

uri

--
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 -- http://www.stemsystems.com/class


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

Date: Fri, 05 Sep 2003 10:07:49 -0800
From: blob <jaws@skyinet.net>
Subject: Net::SSH::Perl
Message-Id: <3f57f2ae@news.skyinet.net>

Hi all,

Below is my script that will be used to connect to a remote host and 
change my password automatically:

===========================================
#!/usr/bin/perl


use strict();
use Net::SSH::Perl;


$user="jaws";
$pass="password";
$host="xxx.xxx.xxx.xxx";
$old_password="password";
$new_password="newpass";


my $ssh = Net::SSH::Perl->new($host,debug=>1,use_pty=>1);
$ssh->login($user, $pass);


$ssh->register_handler("stderr", sub {
     my($channel, $buffer) = @_;
     my $str = $buffer->bytes;


     if ($str eq "Enter login password: ") {
         $channel->send_data($old_password);
     }


     elsif ($str eq "New password: ") {
         $channel->send_data($new_password);
     }

     elsif ($str eq "Re-enter new password: ") {
         $channel->send_data($new_password);
     }
});
$ssh->cmd('passwd');
==========================================

After running the program, my password didnt changed I was still able to 
connect using the old password.

Does anybody has an idea what's missing or wrong with my script?

Thanks.

Jaws



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

Date: 5 Sep 2003 03:53:07 GMT
From: chesucat@freeshell.org
Subject: Re: Net::SSH::Perl
Message-Id: <bj91b2$g765l$2@ID-183606.news.uni-berlin.de>

In comp.lang.perl.misc blob <jaws@skyinet.net> wrote:
b>Hi all,
b>
b>Below is my script that will be used to connect to a remote host and 
b>change my password automatically:
b>
b>===========================================
b>#!/usr/bin/perl
b>
b>
b>use strict();
b>use Net::SSH::Perl;
b>
<snipped>
b>Does anybody has an idea what's missing or wrong with my script?
b>

I didn't know strict was functions?

chesucat

-- 
chesucat@sdf.lonestar.org
no fortune!:-(




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

Date: Fri, 05 Sep 2003 01:28:48 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Order of evaluation of expressions
Message-Id: <3F57E679.7050900@rochester.rr.com>

Anno Siegel wrote:

> Mark Jason Dominus <mjd@plover.com> wrote in comp.lang.perl.misc:
> 
>>In article <slrnbk10md.srs.abigail@alexandra.abigail.nl>,
>>Abigail  <abigail@abigail.nl> wrote:
>>
>>>Where is its order of evaluation documented? Where in the documentation
>>>does it say that:
>>>
>>Yes, that's what I would like to know.
>>Or, if it doesn't say that, I would like to know that it doesn't.
>>
>>Does anyone have any actual facts?
>>
>>I wasn't able to find anything about it in the manuals, but the
>>manuals are pretty badly organized on basic matters like this, so I'm
>>not sure I was looking in the right places.
>>
> 
> Like you, I was never able to find a general commitment in the docs.
> While Perl documentation is huge, and a moving target, I think it's
> safe to say that it is silent about the point.  I mean, *someone*
> would have found it by now :)


Hmmmmm...doesn't the "synopsis" table at the beginning of perlop define 
operator precedence and evaluation order rather nicely and completely? 
It appears to describe the observed behaviors of the operators, and 
doesn't seem to contain any errors or omissions.  That is what I refer 
to when I have precedence or evaluation order issues.


 ...


> Anno
> 

-- 
Bob Walton



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

Date: 5 Sep 2003 01:41:44 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Order of evaluation of expressions
Message-Id: <slrnblfqeo.f7m.sholden@flexal.cs.usyd.edu.au>

On Fri, 05 Sep 2003 01:28:48 GMT, Bob Walton <bwalton@rochester.rr.com> wrote:
> Anno Siegel wrote:
> 
>> Mark Jason Dominus <mjd@plover.com> wrote in comp.lang.perl.misc:
>> 
>>>In article <slrnbk10md.srs.abigail@alexandra.abigail.nl>,
>>>Abigail  <abigail@abigail.nl> wrote:
>>>
>>>>Where is its order of evaluation documented? Where in the documentation
>>>>does it say that:
>>>>
>>>Yes, that's what I would like to know.
>>>Or, if it doesn't say that, I would like to know that it doesn't.
>>>
>>>Does anyone have any actual facts?
>>>
>>>I wasn't able to find anything about it in the manuals, but the
>>>manuals are pretty badly organized on basic matters like this, so I'm
>>>not sure I was looking in the right places.
>>>
>> 
>> Like you, I was never able to find a general commitment in the docs.
>> While Perl documentation is huge, and a moving target, I think it's
>> safe to say that it is silent about the point.  I mean, *someone*
>> would have found it by now :)
> 
> 
> Hmmmmm...doesn't the "synopsis" table at the beginning of perlop define 
> operator precedence and evaluation order rather nicely and completely? 
> It appears to describe the observed behaviors of the operators, and 
> doesn't seem to contain any errors or omissions.  That is what I refer 
> to when I have precedence or evaluation order issues.

No. It defines associativity and precendence. It does not mention
order of evaluation.

-- 
Sam Holden



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

Date: 4 Sep 2003 16:41:47 -0700
From: srathkopf@juno.com (Steve Rathkopf)
Subject: perl  -w  example.pl
Message-Id: <ae8d5bef.0309041541.5ac01f7a@posting.google.com>

I have 'successfully' downloaded ActiveState's Perl 5.8.0 and, per the
instructions, opened a window and entered the text in the subject line
above.

When I press the return key, nothing happens, the cursor just sits at
the start of the next line.

The program was to print one line of text, but does nothing.

The above behaviour is exhibited whether I start an MS-DOS session
from the PROGRAMS menu, or activate one of the Perl applications in
the Perl directory.

I was studying Perl on the Unix machine where I just completed a
contract, and may simply be confused, because this is NOT Unix.  I had
NO problems, aside from the need to debug, on the Unix machine.  Now,
I can't even print a one liner from the prompt.

Can someone point me in the correct direction?

Thanks, in advance,
Steve Rathkopf


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

Date: Fri, 05 Sep 2003 02:06:05 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: perl  -w  example.pl
Message-Id: <3f57d3d0$0$193$58c7af7e@news.kabelfoon.nl>

Steve Rathkopf wrote:

> I have 'successfully' downloaded ActiveState's Perl 5.8.0 and, per the
> instructions, opened a window and entered the text in the subject line
> above.
> 
> When I press the return key, nothing happens, the cursor just sits at
> the start of the next line.
> 
> The program was to print one line of text, but does nothing.
> 
> The above behaviour is exhibited whether I start an MS-DOS session
> from the PROGRAMS menu, or activate one of the Perl applications in
> the Perl directory.
> 
> I was studying Perl on the Unix machine where I just completed a
> contract, and may simply be confused, because this is NOT Unix.  I had
> NO problems, aside from the need to debug, on the Unix machine.  Now,
> I can't even print a one liner from the prompt.
> 
> Can someone point me in the correct direction?

post example.pl

I have been running activestate for ages and it works great.

If you want a more GNU like experience check out http://www.cygwin.com/ 
It has its own perl version.

Also, rxvt is great, a real terminal. If you need help with the set up, 
check out my weblog at URI in sig.

-- 
Kind regards,       feel free to mail: mail(at)johnbokma.com (or reply)
                     virtual home: http://johnbokma.com/  ICQ: 218175426
John                web site hints: http://johnbokma.com/websitedesign/



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

Date: Fri, 05 Sep 2003 01:07:58 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: perl  -w  example.pl
Message-Id: <3F57E197.3010809@rochester.rr.com>

Steve Rathkopf wrote:

> I have 'successfully' downloaded ActiveState's Perl 5.8.0 and, per the
> instructions, opened a window and entered the text in the subject line
> above.


Hmmmmm...I assume you also installed Perl?  That's just a bit more than 
just downloading it.


> 
> When I press the return key, nothing happens, the cursor just sits at
> the start of the next line.
> 
> The program was to print one line of text, but does nothing.
> 
> The above behaviour is exhibited whether I start an MS-DOS session
> from the PROGRAMS menu, or activate one of the Perl applications in
> the Perl directory.
> 
> I was studying Perl on the Unix machine where I just completed a
> contract, and may simply be confused, because this is NOT Unix.  I had
> NO problems, aside from the need to debug, on the Unix machine.  Now,
> I can't even print a one liner from the prompt.
 ...
> Steve Rathkopf
> 

Did you change directory (cd) to the directory where example.pl is 
stored (your description did not indicate you took that step)?  On my 
system that is c:\perl\eg .  What do you get if you type:

    perl -v

at a command prompt?  Also try:

    perl -e "print 'hi there'"

If those work, then it would appear that Perl is working.

I can't think of anything which would cause the behavior you describe, 
unless you have another program called example.pl other than the one 
that ships with ActiveState Perl.  It is certainly possible to write a 
Perl program that does what you describe.  For example:

    <>

as a Perl program would do what you describe.

-- 
Bob Walton



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

Date: Thu, 04 Sep 2003 23:41:10 +0100
From: pkent <pkent77tea@yahoo.com.tea>
Subject: Re: Redirect stdio into a string
Message-Id: <pkent77tea-427292.23411004092003@usenet.force9.net>

In article <368466cc.0309032208.4af16e6@posting.google.com>,
 neruson_newsletter@yahoo.ca (Initial-N) wrote:

> How to catch all stdio output into a string?
> I am using system() to call a external tool (exe), with some
> arguments. Just doing so, it will print out all lot of data (which I
> need to process it within the script). I wonder how I can catch all
> the stdio ouput and redirect them into a string so that I can parse
> it.

It sounds like you want the backticks or qx() operator. This returns the 
output of the command, like:

my $x = `ls`;
print length $x;

prints 46 just now.

P

-- 
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply


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

Date: Thu, 04 Sep 2003 18:42:05 +0200
From: o0o <o0o@shitrit.com>
Subject: Re: Replacing text - problem with $1
Message-Id: <3f575daa$1@news.012.net.il>

Martin Kristensen wrote:

> I'm trying to replace some text in some txt-files with a perl call
> like this...
> 
> perl -pi -e "s/brad(.+?)bill/brian$1bob/gm;" *.txt
> 
> This should replace "brad123bill" by "brian123bob" - but instead I
> just get "brianbob". What's wrong? Probably something with the $1
> variable, but what?
> 
> Regards
> Martin
I guess you use kind of unix shell. Try replacing the double quotes with 
single ones.

;-)
o0o



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

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


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