to get a very wide range of answers, not just regex-based.
Thanks! Looking forward to the fun!
David
On Sat, Aug 13, 2016 at 3:45 PM, Richard Heintze via beginners
<beginners@perl.org> wrote:
I this perl one liner for evaluating infix expressions in VI and emacs/VI
emulator mode:
I this perl one liner for evaluating infix expressions in VI and emacs/VI
emulator mode:
.! perl -MPOSIX -pe ' BEGIN{ $np = qr{ \( (?: (?> [^()]+ ) | (??{ $np }) )*
\) }x;$funpat = qr/$np/;}
s/($funpat)=($funpat|(")[^\"]*(")|[0-9\.]+)/"$1=$3".eval($1)."$4"/ge'
That $np is from the camel
I just love using viper mode in emacs to execute perl:
.! perl -MPOSIX -pe ' BEGIN{ $np = qr{ \( (?: (?> [^()]+ ) | (??{ $np }) )* \)
}x;$funpat = qr/$np/;} s/($funpat)=(.*)$/"$1=$3".eval($1)."$4"/ge'
This command searches for a balanced set of parens (from the camel book)
followed by an
Is there any standard for documenting functions?
For example, in Javadoc, there is a specific format
that uses the @ for identifying and formating the
function argruments. It looks like POD much more
freeform and is not nearly so detailed. Is that true?
Siegfried
P.S. Sorry Charles, I
Apparently there is some counterpart to javadoc for
perl. I tried perldoc perldoc but that is not what I
wanted. I want to know how I should be formating the
comments for my perl code. What topic do I look under
in perldoc?
Thanks,
siegfried
This code is not reading the entire file. It is my
intent that it read the entire file. Can somone help
me remedy this problem?
Thanks,
Siegfried
open (INFILE, data.txt);
my $backgr_data=INFILE;
__
Do you Yahoo!?
Win a
I think I solved my own problem.
I'm using a
my @backgr_data=INFILE;
to read everything. Is the above less efficient than
below?
read INFILE, $backgr_data, $some_really_big_number;
Thanks,
Siegfried
This code is not reading the entire file. It is my
intent that it read the entire file.
The following statement is causing the warning in the
subject line. Am I doing something wrong or is there a
flaw in the cgi module I'm using?
line 172: foreach ($q-param) {
I am also getting this same error (or is it a
warning?) when I call a function:
$Case = $factory-mfr(name =
I'm using these statements in my main program:
use DisplayPCE qw($order $fnx );
...
print join(, map { qq[td$_/td] }
@{$DisplayPCE::order});
...
When I use the debugger, I find that order is
undefined! When I use the browser to view the page,
the value of undef is confirmed.
When I abandon
I'm passing a singularly dimensioned array to a
function. I need to clear the array in the function so
that when I return to the main program, there are no
entries in the array variable I passed to the
function.
Can someone write a small function that does this?
Thanks,
Sieg
I have a bit array I need to store in GET/POST
parameters and input type=hidden fields. Presently
I'm storing one bit per hidden field.
I would like to optimize this and use a little less
space. If I know I need less than 32 elements in my
boolean (bit) array, I can just use an integer in a
I'm trying to index into some function parameters that
are passed as array references.
Is strategy #1 (see below) identical to strategy #2? I
thought so. I had a bug I that I fixed by recoding
strategy #1 as strategy #2 and it fixed the problem.
This leads me to believe they are not identical.
I find I'm undefining variables my assigning an
unitialized variable to defined value to make it
undefined (as exemplified below).
Is there a better way to do this?
my $k;
for($i = 0; $i $c; $i++){
if ( defined $k ){
print $x[$k];
my $t; # intentionally undefined
$k = $t; #
and looked thru my perldoc but could
not find it. What is the name of feature for storing
large boolean arrays?
Thanks,
Siegfried
--- WC -Sx- Jones [EMAIL PROTECTED] wrote:
Richard Heintze wrote:
What if I need more than 32 elements in my bit
array?
I suppose I could use
I have an array of hashes. What function should I be
using to interrogate each array cell when I want to
know if it is occupied?
exists seemed to do the job nicely. What about
defined?
Now I am curious: how would I implement a switch
statement (er, I mean, set of if-elsif statements) for
a
Speaking of documentaiton, is there any structured
approach to documenting the get/post parameters for a
perl web page?
I have a main menu type of of page I have inherited.
The GUI designer is not a programmer seems to have a
strong preference buttons instead of links or drop
down menus.
Each
Is there a way I can explictly declare that each array
cell contains a hash?
Here is the only way I know to do it:
my @PCEs=[];
while ($Data-FetchRow()) {
my %dh = $Data-DataHash();
$PCEs[$cn]{$dh{id}} = $dh{ridPCE};
}
This my declaration only says that it is an array,
not an array of
Question #1: Does anyone have any favorite document
that is a style guide for perl programmers? There are
entire books on the subject of style for C++
programmers, I've not seen any for perl, though.
I'm in the unfortunate position of being a lone
programmer on a Perl project. I've taught myself
I have a perl cgi file that works fine. However, I
want to move it into a sub directory -- the cgi-bin
directory for Apache HTTPD is just getting too
crowded.
So I created a directory and moved my file. It could
not find my evidence_db.pm file (which defined
variables like $sCssRoot that contain
Jenda,
Sorry -- I was not quoting my own code precisely and
I am using strict and warnings.
I am using parenthesis. I attached the exact code
for the subroutine below.
--- Jenda Krynicky [EMAIL PROTECTED] wrote:
From: Richard Heintze [EMAIL PROTECTED]
After several hours I tracked it down
I have just discovered the the following code causes
trouble when I have use strict and use warn;
use strict;
use warnings;
my $k = $q-param('xyz');
print qq[ \$k = $k ];
The problem is that if there is no GET/POST param
called xyz, we are concatenating with a null value
and, when using CGI
I think what you want is this:
no warnings qw(uninitialized);
Would I put this immediately after use warnings;?
__
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
--
To unsubscribe, e-mail: [EMAIL
emacs and a number of other editors have the ability,
with a single key stroke to properly indent java code.
However, since perl has such unusual syntax for
specifying literal character strings (my favorite is
qq[]) emacs chokes when it attempts to indent my perl
code. Too bad -- I love emacs.
alternatives. Have
you tried vim?
-Original Message-
From: Richard Heintze
[mailto:[EMAIL PROTECTED]
Sent: Monday, November 03, 2003 11:28 AM
To: [EMAIL PROTECTED]
Subject: Where is editor that will Indent my perl
code?
emacs and a number of other editors have the
ability
I had emailed this query out previously but since I
never saw my own email in the digest, I'm assuming
that it never made it to the [EMAIL PROTECTED] list.
Please forgive me if it did and I did not see it (my
SPAM filter might have eaten it).
Question #1
---
I have an array stored in an
Is this an appropriate place to post questions on
Win32::ODBC/MSAccess 2000/Perl 5.6 cgi/Apache HTTPD?
If not, can someone directe me to an appropriate FAQ
or mailinglist or newsgroup?
I've been struggling with specifying zero length
strings in SQL. Nothing seems to work.
I've tried
The following fragment of code retrieves an integer
from an array that is passed by reference. It was
working fine:
my $t = @$curr_true[$ev_count];
I made some changes else where in the program (from
which this fragment comes) and suddely both the web
server and (thank goodness) the
Why does this program print yes def but not yes
xyz? It does print xyz:def, so I don't understand
why it does not print yes xyz.
{
my %x = ( xyx = 'abc', d = 'y', f = 'g' );
$x{def} = fhi;
print qq($_ : ).$x{$_}.qq(\n) foreach (keys %x);
foreach (keys %x) { print yes xyz\n if ($_ =~
My program is terminating for no reason apparent to
me!
Using the debugger I see that $$curr_true is a 4
element array whose values are undef, 1, 4, 7.
$ev_count is 1.
Why would both my debugging session suddenly and my
cgi script end when I execute that last statement?
Thanks,
Siegfried
Presently I'm using an integer to implemement an array
of booleans.
I suspect this won't work beyond 32 array elements. Is
there a better way to accommodate longer bit arrays?
Could I use a string, for example, to store an array
of bits? Can I just use the bit manipulation operators
(^= = |=) on
I apologize if I'm posting this twice. I assume that
it did not go out to the group because I did not get
any responses and the folks at [EMAIL PROTECTED] have
been extremely helpful in the past.
Can somone help me make my sample program work below?
(1) I cannot call function hello from main.pl.
I need my web site to automatically send an email
confirmation. I'm using CGI Perl 5.6 on IIS on
Win2000.
What options are there for doing this?
__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
To
I have an nice little example that demonstrates how to
use COM from a console mode perl program.
However, I want to use COM from a perl CGI page and
microsoft discourages ASP programmers from createing
their own COM objects directly. ASP programmers are
encouraged to use the built-in Server
Some help understanding this program would be greatly
appreciated! I'm really struggling with this perl
language!
Thanks,
siegfried
my $x= {'d' = 'y', 'f' = 'g'},
$y = ['a', 'b', 'c', 'd'];
# This works! Good!
foreach my $i (@{$y}){ print array i = $i\n }
# (1) Why does
Thank you very much James and David! Wow! What prompt
responses!
I have some more questions!
I tried use strict; and that worked. Are you
encouraging me to use use warn; too? That does not
work.
# $i receives the proper values
foreach my $i (keys %{$x}) {
# (4) Why does not this work?
Sorry James, you got a second copy. I meant to reply
to the group.
James,
thank you, thank you!
Can you explain this syntax then, that is used with
foreach loops?
foreach my $i (keys %{$x}) { ... }
Why don't we use foreach my $i (keys $$x){... }?
What is the name for this syntax: (keys
James,
I hope this is my last question. I appreciate your
(and everyone else's that has contributed)
generousity.
I have a web site I inherited where a single page has
3000 lines of perl code. It does not use strict or
warnings. The original authors only used global
variables and never used any
Thanks James, I think I understand now!
Here is another topic:
What is happening to my second argument here? It is
not being passed!
use CGI qw(:standard);
$q = new CGI;
sub print_args {
my ($a, $b, $c) = @_;
print a = $a b = $b c=$c\n;
}
print_args(abc, $q-param('next'), xyz);
# However,
your suggestion of using scalar a
little later...
Siegfried
--- James Edward Gray II [EMAIL PROTECTED]
wrote:
On Saturday, May 31, 2003, at 05:01 PM, Richard
Heintze wrote:
Thanks James, I think I understand now!
Glad to hear it.
Here is another topic:
My, my you
39 matches
Mail list logo