[25338] in Perl-Users-Digest
Perl-Users Digest, Issue: 7583 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 28 14:05:53 2004
Date: Tue, 28 Dec 2004 11:05:19 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 28 Dec 2004 Volume: 10 Number: 7583
Today's topics:
Re: For your christmas reading pleasure. <bik.mido@tiscalinet.it>
Re: getting array elements (Anno Siegel)
Re: getting array elements <spamtrap@dot-app.org>
Re: getting array elements <nospam@nospam.com>
Re: getting array elements <spamtrap@dot-app.org>
Re: getting array elements <nospam@nospam.com>
Re: getting array elements <spamtrap@dot-app.org>
Re: getting array elements <nospam@nospam.com>
Re: handle multiple submit button. <bik.mido@tiscalinet.it>
Re: handle multiple submit button. <matternc@comcast.net>
Re: handle multiple submit button. <noreply@gunnar.cc>
Re: handle multiple submit button. <tadmc@augustmail.com>
Re: handle multiple submit button. <spamtrap@dot-app.org>
Hard coded vs. variable assignment using in SQL stateme <jack@swamc.com>
Re: Hard coded vs. variable assignment using in SQL sta <x3v0-usenet@yahoo.com>
Re: Hard coded vs. variable assignment using in SQL sta <sam.wun@authtec.com>
Re: Hard coded vs. variable assignment using in SQL sta <jack@swamc.com>
Re: Hard coded vs. variable assignment using in SQL sta <jgibson@mail.arc.nasa.gov>
Re: Hard coded vs. variable assignment using in SQL sta <tadmc@augustmail.com>
Re: Hard coded vs. variable assignment using in SQL sta <tadmc@augustmail.com>
Re: Help needed for perl rookie <grlcopm@pacbell.net>
Re: Help needed for perl rookie <grlcopm@pacbell.net>
Re: Help needed for perl rookie <grlcopm@pacbell.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 28 Dec 2004 17:17:27 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: For your christmas reading pleasure.
Message-Id: <d213t014ro2ug3sjlrkv3goqavd4cm7eto@4ax.com>
[originally on ctt - crossposted to clpmisc]
On Fri, 24 Dec 2004 22:58:04 GMT, Ian Hutchinson
<hutch@hutchinson.belmont.ma.us> wrote:
>complete TeX parser cannot be built using lex. I should know, since I
>have built what is probably the most powerful incomplete one (TtH) built
>with (f)lex. The reason is, of course, that everything in TeX (including
>tokenization) depends on the context (as the xii.tex wizardry magically,
>and for today topically, demonstrates).
This has been discussed many times here. It somehow reminds me of
similar discussions about Perl. (History has been repeating also wrt
Perl6 which some user hoped to be somewhat "more regular", instead
rumors have it that not only the following will continue to be true
about it: "nothing but perl can parse Perl", but that the much
stronger will hold too "nothing but Perl can parse Perl".)
Now it occurs to me that even if all of these discussions are highly
hypothetical, in another thread informed TeXperts expressed the need
for a thorough reimplementation in a suitable language to overcome
some of its current limitations. I dared to suggest Perl6 (making the
issue even more hypthetical, if possible), with its extensive support
for grammars, but then David Kastrup, who is a very knowledgeable
person, answered that in any case it would lack the necessary
structures, to which I replied asking if he knew what Perl6 is
supposed to look like (and he said he did, but I still have doubts).
So the question/hint for a discussion is this: could Perl6 -still
*hypothetically* speaking- be the base for the implementation of a
modern TeX successor?
Michele
--
>It's because the universe was programmed in C++.
No, no, it was programmed in Forth. See Genesis 1:12:
"And the earth brought Forth ..."
- Robert Israel in sci.math, thread "Why numbers?"
------------------------------
Date: 28 Dec 2004 14:18:24 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: getting array elements
Message-Id: <cqrpvg$dau$1@mamenchi.zrz.TU-Berlin.DE>
daniel kaplan <nospam@nospam.com> wrote in comp.lang.perl.misc:
> i realize now why some people are "stuffy" about making sure you post some
> full code-snippet. ...
It is nice to see you arrive at this conclusion. How about an apology
to the people you insulted over this very point?
Anno
------------------------------
Date: Tue, 28 Dec 2004 09:34:24 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: getting array elements
Message-Id: <16SdnYN1x8Js80zcRVn-iQ@adelphia.com>
Anno Siegel wrote:
> It is nice to see you arrive at this conclusion. How about an apology
> to the people you insulted over this very point?
I'm not holding my breath waiting for it...
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 28 Dec 2004 10:23:44 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: getting array elements
Message-Id: <1104247457.457165@nntp.acecape.com>
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:cqrpvg$dau$1@mamenchi.zrz.TU-Berlin.DE...
>
> It is nice to see you arrive at this conclusion. How about an apology
> to the people you insulted over this very point?
>
what i "reacted" to was not the requirements but the delivery...i know this
is donkey like, but everything is a two-way street. so since i am not
holding my breath on hearing anything likewise from you, i'll just keep
going my own way thanks
------------------------------
Date: Tue, 28 Dec 2004 11:03:38 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: getting array elements
Message-Id: <IrCdnb9AJ7BGHkzcRVn-iA@adelphia.com>
daniel kaplan wrote:
> what i "reacted" to was not the requirements but the delivery...
Really? That's not what Google says.
Here's your first few question to this group:
<http://tinyurl.com/4c7ph>
<http://tinyurl.com/63mek>
<http://tinyurl.com/5rzhu>
After that things start going downhill. You asked a non-sensical
question, and were politely pointed to a site that would help you learn
the basics. You responded by stating that you didn't want a tutorial,
because you're a "dive in" kind of guy:
<http://tinyurl.com/53d57>
I could go on - things went rapidly downhill after that. You can claim
whatever you want, but the facts are right there in the archives for
everyone to see: You didn't start collecting flames until *after* you
started acting like a spoiled brat.
Sorry Daniel, but the record speaks for itself.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 28 Dec 2004 11:55:46 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: getting array elements
Message-Id: <1104252980.557395@nntp.acecape.com>
"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:IrCdnb9AJ7BGHkzcRVn-iA@adelphia.com...
go and pull (and analyze) whatever you like sherm, seriously....i know how i
read all the posts, and you know how you read them....but i'm not going to
sit here and waste my time showing why i i read them differently than
you.....just done talking about this. i'm just not gonna be pulled into
these discussions anymore....
so if you want to talk perl, great, (i killed my kill rule) but if you
continue to type about why i am wrong and you right, as much as you like, am
sure other people would love to rehash this mess all over again.....but if
it's just for my sake, save your typing...
daniel
------------------------------
Date: Tue, 28 Dec 2004 13:02:01 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: getting array elements
Message-Id: <IrGdnaWAhdQHAkzcRVn-3A@adelphia.com>
daniel kaplan wrote:
> go and pull (and analyze) whatever you like sherm
What is there to analyze? Your record here speaks for itself.
> it's just for my sake, save your typing
It's not for your sake - as far as I knew you weren't even reading my posts.
There are others here who might learn from your mistakes. What you get
out of this group will reflect what you put into it, and your posting
history is proof of that.
Your first few posts here were quite reasonable, and were responded to
in kind. Then when you started copping an attitude, you got spanked for
it. It's all right there in the archives, so pretending it happened the
other way around is pointless.
> so if you want to talk perl, great
We *were* talking Perl, until you made your "I realize now why some
people were stuffy ..." comment. You started the off-topic tangent. Not
Anno, not me, *you*. I didn't just dig up your history for fun - I did
so in response to *your* comment, in a thread that *you* started.
Once again, you're getting precisely what you asked for - and once again
you're whining about it. Won't you ever learn???
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 28 Dec 2004 13:48:54 -0500
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: getting array elements
Message-Id: <1104260357.110668@nntp.acecape.com>
on Dec 28, 10:02 am Sherm Pendley
>>We *were* talking Perl, until you made your "I realize now why some
>>people were stuffy ..." comment
i will do exactly as i have said, and not waste my time replying to whatever
shots you wish to take
i will take back the stuffy tho, i should haev said: now i realize why
people are "insistent" about posting code snippets
daniel
------------------------------
Date: Tue, 28 Dec 2004 17:17:30 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: handle multiple submit button.
Message-Id: <sgl2t0tulace9agdtu663dk62jan9blc16@4ax.com>
On Tue, 28 Dec 2004 11:33:56 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>> My pervious post
>
>Which previous post?
Pay attention: he never said "previous post"...
;-)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Tue, 28 Dec 2004 12:54:11 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: handle multiple submit button.
Message-Id: <nP-dna28M6deAEzcRVn-ig@comcast.com>
Michele Dondi wrote:
> On Tue, 28 Dec 2004 11:33:56 +0100, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>
>>> My pervious post
>>
>>Which previous post?
>
> Pay attention: he never said "previous post"...
> ;-)
>
Hey, stop make pervious posts! There's already too much pervy
stuff on the internet!
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Tue, 28 Dec 2004 19:19:29 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: handle multiple submit button.
Message-Id: <33dn5jF3uvv0hU1@individual.net>
sam wrote:
> Gunnar Hjalmarsson wrote:
>> Name the buttons, for instance:
>>
>> <input type="submit" name="optA" value="Option A">
>> <input type="submit" name="optB" value="Option B">
>>
>> In the script:
>>
>> use CGI;
>> my $q = new CGI;
>>
>> if ( $q->param('optA') {
>> # do something
>> } else {
>> # do something else
>> }
>
> My current perl script only is written full of print statements, with
> the following form:
>
> print "<form action=main.cgi>\n";
> ...
> print "<input type=submit value=\"callself.pl\">\n";
> print "</form>";
> ...
That means that the form is not part of a static HTML page, but included
in a page generated by the script.
> Do I need to change all print statements with CGI?
I'm not able to tell; it depends on what it is you want to do.
I would suggest that you pick a tutorial about CGI programming in Perl
and spend some time with it. This link may be helpful:
http://cgi.resourceindex.com/Documentation/CGI_Tutorials/
When you feel you are ready, write a *very short* script that
illustrates the principles of what you want to do. If you encounter
problems, please feel free to ask again. Dependent on the nature of your
problems, this group may be the right place to post, but if it's about
HTML or CGI rather than Perl, you'd better post to
comp.infosystems.www.authoring.cgi instead.
Good luck!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 28 Dec 2004 12:31:59 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: handle multiple submit button.
Message-Id: <slrnct39kv.t1g.tadmc@magna.augustmail.com>
Chris Mattern <matternc@comcast.net> wrote:
> Michele Dondi wrote:
>
>> On Tue, 28 Dec 2004 11:33:56 +0100, Gunnar Hjalmarsson
>> <noreply@gunnar.cc> wrote:
>>
>>>> My pervious post
>>>
>>>Which previous post?
>>
>> Pay attention: he never said "previous post"...
>> ;-)
>>
> Hey, stop make pervious posts! There's already too much pervy
> stuff on the internet!
Yeah, like a unique per-version number for each version of a software.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 28 Dec 2004 13:46:34 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: handle multiple submit button.
Message-Id: <_8adnQtgEvOWN0zcRVn-sg@adelphia.com>
Tad McClellan wrote:
> Yeah, like a unique per-version number for each version of a software.
Is that what you get when you use Perforce to manage your source?
Or is that like a consolation prize when your app is listed at
<http://www.perversiontracker.com>?
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 28 Dec 2004 23:28:12 +0800
From: Jack <jack@swamc.com>
Subject: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <cqrvk4$22ev$1@news.hgc.com.hk>
Hi,
I use MySQL 5.0 with perl (the latest version) in FreeBSD 5.3.
I found that if I assign a hard coded string (with double quote) to the
string variable which in turns become part of the SQL statement, the SQL
does return result.
If I assign a value which is returned from an array in perl (eg.
@array[1]) and use this variable in the SQL statement, the SQL does not
return any result.
For example:
The following code does not return any result when I use it in SQL
statement:
my $mycustcode = "@outlets[1]"; # this array contains string "07-2-0057"
However, if I use the following hard coded assignment, the SQL statement
returns result:
# my $mycustcode = "07-2-0057";
Here is the SQL statement for MySQL 5.0:
$create_view_sql = qq {create view $viewtab as
select c.custcode, c.custname, c.type, sum(t.netsales)
as sales
from customer c, transaction t
where c.custcode = t.custcode
and date(t.date) >= "$start_date"
and date(t.date) <= "$end_date"
and (c.type = "EXPORT" or c.type = "LOCAL")
and (c.custcode = "$mycustcode")
group by c.custcode;};
I may be using incorrect way of spliting the tokens, here is the
function to extract a list of the token:
$outlet_str = $in{'outlets'}
Thanks
Jack
------------------------------
Date: Tue, 28 Dec 2004 10:39:48 -0500
From: Ken <x3v0-usenet@yahoo.com>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <97fAd.13409$IZ2.10222@fe37.usenetserver.com>
Jack wrote:
> Hi,
>
> I use MySQL 5.0 with perl (the latest version) in FreeBSD 5.3.
> I found that if I assign a hard coded string (with double quote) to the
> string variable which in turns become part of the SQL statement, the SQL
> does return result.
> If I assign a value which is returned from an array in perl (eg.
> @array[1]) and use this variable in the SQL statement, the SQL does not
> return any result.
>
> For example:
> The following code does not return any result when I use it in SQL
> statement:
> my $mycustcode = "@outlets[1]"; # this array contains string "07-2-0057"
>
Are you sure that @outlets[1] is the correct way to access the variable
you want? If it is an array then it should be $outlets[1].
- Ken
------------------------------
Date: Tue, 28 Dec 2004 23:57:25 +0800
From: sam <sam.wun@authtec.com>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <cqs1at$238a$1@news.hgc.com.hk>
Ken wrote:
> Jack wrote:
>
>> Hi,
>>
>> I use MySQL 5.0 with perl (the latest version) in FreeBSD 5.3.
>> I found that if I assign a hard coded string (with double quote) to
>> the string variable which in turns become part of the SQL statement,
>> the SQL does return result.
>> If I assign a value which is returned from an array in perl (eg.
>> @array[1]) and use this variable in the SQL statement, the SQL does
>> not return any result.
>>
>> For example:
>> The following code does not return any result when I use it in SQL
>> statement:
>> my $mycustcode = "@outlets[1]"; # this array contains string "07-2-0057"
>>
>
> Are you sure that @outlets[1] is the correct way to access the variable
> you want? If it is an array then it should be $outlets[1].
>
OK, I changed it to "$outlets[1]", but the query still does not return
result. I have also checked its value with the print $outlets[1]
statement, it prints out the desire value as I expected. But when it
used in SQL statement, it failed to match with the AND statement.
Another strange issue is if I assigned "$outlets[0]" to the variable,
the SQL statement does return result. There 3 elements in the error,
$outlets[1] is the second element.
Thanks
Sam
Thanks
Sam
> - Ken
>
------------------------------
Date: Wed, 29 Dec 2004 00:07:58 +0800
From: Jack <jack@swamc.com>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <cqs1um$23il$1@news.hgc.com.hk>
sam wrote:
> Ken wrote:
>
>> Jack wrote:
>>
>>> Hi,
>>>
>>> I use MySQL 5.0 with perl (the latest version) in FreeBSD 5.3.
>>> I found that if I assign a hard coded string (with double quote) to
>>> the string variable which in turns become part of the SQL statement,
>>> the SQL does return result.
>>> If I assign a value which is returned from an array in perl (eg.
>>> @array[1]) and use this variable in the SQL statement, the SQL does
>>> not return any result.
>>>
>>> For example:
>>> The following code does not return any result when I use it in SQL
>>> statement:
>>> my $mycustcode = "@outlets[1]"; # this array contains string "07-2-0057"
>>>
>>
>> Are you sure that @outlets[1] is the correct way to access the
>> variable you want? If it is an array then it should be $outlets[1].
>>
> OK, I changed it to "$outlets[1]", but the query still does not return
> result. I have also checked its value with the print $outlets[1]
> statement, it prints out the desire value as I expected. But when it
> used in SQL statement, it failed to match with the AND statement.
>
> Another strange issue is if I assigned "$outlets[0]" to the variable,
> the SQL statement does return result. There 3 elements in the error,
> $outlets[1] is the second element.
>
The value of the custcode is 07-3-0037, when it is used in MySQL
statement, is there a way to force it to be a string rather than a date
format?
In the SQL statement I wrote (in perl), regardless of having double
quote or not, there is not result return from the following statement:
AND c.custcode = "$mycustcode"
Thanks
> Thanks
> Sam
>
>> - Ken
>>
------------------------------
Date: Tue, 28 Dec 2004 09:13:55 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <281220040913552825%jgibson@mail.arc.nasa.gov>
In article <cqs1um$23il$1@news.hgc.com.hk>, Jack <jack@swamc.com> wrote:
> sam wrote:
> >
> The value of the custcode is 07-3-0037, when it is used in MySQL
> statement, is there a way to force it to be a string rather than a date
> format?
> In the SQL statement I wrote (in perl), regardless of having double
> quote or not, there is not result return from the following statement:
> AND c.custcode = "$mycustcode"
Perl does not have a primitive, built-in date scalar value. It has only
numeric, string, and reference scalar values, so '07-3-0037' IS a
string.
You need to post a complete, working, short-as-possible program that
anyone can run to get more help. In general, you should print out the
values of variables to see what they contain, but you seem to be doing
that.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
------------------------------
Date: Tue, 28 Dec 2004 11:46:25 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <slrnct36vh.sud.tadmc@magna.augustmail.com>
Jack <jack@swamc.com> wrote:
> my $mycustcode = "@outlets[1]"; # this array contains string "07-2-0057"
You should always enable warnings when developing Perl code.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 28 Dec 2004 11:48:28 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Hard coded vs. variable assignment using in SQL statement.
Message-Id: <slrnct373c.sud.tadmc@magna.augustmail.com>
sam <sam.wun@authtec.com> wrote:
> Ken wrote:
>> Jack wrote:
> OK, I changed it
But Ken made that suggestion to Jack and you are sam.
Do you (sam) have access to Jack's code somehow?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 28 Dec 2004 16:31:37 GMT
From: GRLCOPM <grlcopm@pacbell.net>
Subject: Re: Help needed for perl rookie
Message-Id: <BDF6CA10.30B2A%grlcopm@pacbell.net>
> From: Bob Walton <see_sig@invalid>
> Organization: Newsfeed.com http://www.newsfeeds.com 100,000+ UNCENSORED
> Newsgroups.
> Newsgroups: comp.lang.perl.misc
> Date: Mon, 27 Dec 2004 22:34:20 -0500
> Subject: Re: Help needed for perl rookie
>
> GRLCOPM wrote:
>
>> I am new to perl, but so far have had decent success in writing/modifying
>> code to do what I want to do. However I am stuck trying to modify the
>> following code. I am sure the solution is quite simple, but I can't
>> completely figure out what this piece of code does. I think it is just
>> matching up a data pattern but this is an area I am unfamiliar with.
>>
>> All I want to do is change the format of the data file from example #1 to
>> example #2 and need this section of code to work with the new format. I
>> would be grateful for any help provided in understanding what this piece of
>> code does and suggestions on the modification needed.
>>
>> If more information or a larger chunk of the code is needed please let me
>> know and I will provide.
>>
>> EXAMPLE #1 - Current format of data file:
>> 0000000050 20041227 0000000003 'my-page.shtml'
>> 0000000054 20041227 0000000004 'another-page.shtml'
>> 0000000020 20041227 0000000003 'yet-another-page.shtml'
>>
>> EXAMPLE #2 - New format of data file:
>> 0000000050|20041227|0000000003|my-page.shtml
>> 0000000054|20041227|0000000004|another-page.shtml
>> 0000000020|20041227|0000000003|yet-another-page.shtml
>
> Your example #2 is in "pipe-delimited" form -- the best way to
> split it apart is with the split() function, as in:
>
> ($acc,$day,$dayacc,$uri)=split /\|/,$line;
>
>
>> if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
>
>
> --
> Bob Walton
> Email: http://bwalton.com/cgi-bin/emailbob.pl
Thanks Bob,
I am familiar with the split function and have been looking for a solution
that utilizes it, but the line you provided does not seem to work as a
replacement for the line I included. I have been looking through
documentation including the references you provided, but I am still having a
hard time with this. I guess what I am looking for is someone to break down
what is happening in this line so that I can modify it to work as I need it
to. Here is the section of code in question.
&LockOpen (COUNT,"$AccessFile");
$location = tell COUNT;
while ($line = <COUNT>) {
if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
if ($uri eq $doc_uri) {
last;
}
}
last if ($uri eq $doc_uri);
$location = tell COUNT;
$acc = 0;
$dayacc = 0;
}
And here is the specific line:
if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
It reads the data file that is in this format:
EXAMPLE #1 - Current format of data file:
0000000050 20041227 0000000003 'my-page.shtml'
0000000054 20041227 0000000004 'another-page.shtml'
0000000020 20041227 0000000003 'yet-another-page.shtml'
I need it to perform the same function on a data file in this format:
EXAMPLE #2 - New format of data file:
0000000050|20041227|0000000003|my-page.shtml
0000000054|20041227|0000000004|another-page.shtml
0000000020|20041227|0000000003|yet-another-page.shtml
Based on the way this program works, my guess is that $uri is being compared
with the data inside the quotes '(\S+)' taken from the current line of the
data file. Right?
I appreciate your help and any further advice you or anyone else can offer.
- Patrick
------------------------------
Date: Tue, 28 Dec 2004 16:35:42 GMT
From: GRLCOPM <grlcopm@pacbell.net>
Subject: Re: Help needed for perl rookie
Message-Id: <BDF6CB05.30B3F%grlcopm@pacbell.net>
> From: Jim Keenan <jkeen_via_google@yahoo.com>
> Newsgroups: comp.lang.perl.misc
> Date: Tue, 28 Dec 2004 03:59:08 GMT
> Subject: Re: Help needed for perl rookie
>
> GRLCOPM wrote:
>> I am new to perl,
>
>
> For your future reference: Read the posting guidelines for this Usenet
> news group: http://mail.augustmail.com/~tadmc/clpmisc.shtml
>
> As the guidelines advise, put your real Perl subject in the "Subject"
> line. There's no need to apologize for being a rookie provided you make
> a genuine effort to solve the problem yourself prior to posting. But
> the fact that you're new to Perl, should you wish to include it, is best
> included in the body of your posting. Don't take up valuable Net real
> estate by wasting it on the Subject line. HTH.
>
> Jim Keenan
Thanks Jim.
At the time I posted the question I was really lost as to what exactly my
question was... that is why I used the subject line I did.
I apologize to the group and hope you will excuse my breech of etiquette
this time. I will try to be more specific with my subject line in the
future.
-Patrick
------------------------------
Date: Tue, 28 Dec 2004 17:16:12 GMT
From: GRLCOPM <grlcopm@pacbell.net>
Subject: Re: Help needed for perl rookie
Message-Id: <BDF6D47F.30B4C%grlcopm@pacbell.net>
> From: Jim Gibson <jgibson@mail.arc.nasa.gov>
> Organization: Newsfeed.com http://www.newsfeeds.com 100,000+ UNCENSORED
> Newsgroups.
> Newsgroups: comp.lang.perl.misc
> Date: Mon, 27 Dec 2004 15:05:04 -0800
> Subject: Re: Help needed for perl rookie
>
> In article <BDF5CC8C.30353%grlcopm@pacbell.net>, GRLCOPM
> <grlcopm@pacbell.net> wrote:
>
>>
>> Yes, that is how I have changed the format of the data file. Replaced the
>> spaces with | and removed the single quotes from the last item on the line.
>>
>> Can someone please explain what the the following line of code does and what
>> the replacement would be?
>>
>> if (($acc,$day,$dayacc,$uri) = ($line =~ /^(\d+) (\d+) (\d+) '(\S+)'$/)) {
>
> Starting from the inner =~ operator and working outwards:
>
Thanks Jim!
At first I missed your reply this morning so please excuse my re-post of the
question.
The line you provided works exactly as desired and in addition I really
appreciate you taking your time to explain the code. Stumbling around in the
dark I managed to get pretty close, but failed to escape the | char.
Thanks again!
Happy Holidays,
Patrick
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7583
***************************************