hi all...
do you know that the function "pack " in perl , work with
which of data structure ???
(e.g : work with array or stack or queue ??)
thx alot.
__
Best regards . Nafiseh Saberi
A bird in the hand ,is worth two in the bush.
www.i
I thought this is a perl mailinglist, not a unix
I need a function in perl to find the latest file
-Ursprüngliche Nachricht-
Von:Neil Fryer [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 29. Oktober 2001 09:21
An: Dolfen, Stefan
Betreff:Re: newbie : how to find
you can define the array and put all of file in it and with
$counter=$#array+1;
then counter contain the number of file in directory and then
with $counter you can open the last file ..
you must put it in filehandler...
bye,
> Hello,
>
> how can I find the latest file in a directory ?
>
> than
I want to have a window loaded when someone leaves my website.
does anyone know what is wrong with the following code?
Thanks!
At 11:53 AM 10/28/2001 -0500, Luinrandir Hernson wrote:
>I want to have a window loaded when someone leaves my website.
>does anyone know what is wrong with the following code?
>Thanks!
>
>
>
>
Try comp.lang.javascript inst
You can use glob to get all the files in the directory. Use the -M or -C
or -A file test on the file name to get the
time depending on your requirement. For more information on these tests
read through perldoc -f -x.
"Dolfen, Stefan" wrote:
> Hello,
>
> how can I find the latest file in a direc
Hi,
Bothered to a code for you check this out.
#!/usr/bin/perl
use integer;
#Keep a default setting to start off with
$str=100; $sfile="";
foreach $i (`ls`) {
chop($i);
if(-f $i) { # change this for including directories also
if (-A $i < $str) { $str = -A $i; $sfile=$i; };
}
}
print "$sfile
hi.
what is the main work of {$a cmp $b} in this code :
@articles = sort {$a cmp $b} @files;
thx
__
Best regards . Nafiseh Saberi
A bird in the hand ,is worth two in the bush.
www.iraninfocenter.net
www.sorna.net
$a and $b are built-in variables used for 'comparison criteria' during the
sort process.
The statement you have posited means that the contents of @files be sorted
alphabetically. The sorting criterion is spelled by $a cmp $b statement.
What this does is to return a 0 if both the candidates are a
Hi all,
i am trying to understand this regex that is supposed to make an
insert into a mysql log. specificlly my questions are:
1. what are the "." (periods) doing?
2. in the string "\', \'" what is the ","(comma) doing
==
The periods are string concatenation operators (tying separate strings
together into a greater string.
In "\', \'" the \' removing the special meaning of the single quote so it
can be included as part of the string, and the commas are argument
separators.
> -Original Message-
> From: [E
hi,
firstly, that's not a regexp, it's a simple concatenation
( the . operator 'glues' two strings together - try
http://japh.nu/index.cgi?base=data_types for a tutorial that mentions this )
secondly, to answer the "\', \'"-question:
it's simply a quoted string
not much unlike "foo", but iwth th
Stefan,
The 'Schwartzian Transform' usually is a good approach for such cases. It is
not very difficult as it seems to be (Thanks to http://5sigma.com of Joseph
Hall). Please follow the comments and it should be pretty straightforward:
Cheers,
Rex
#!/usr/bin/perl
use strict;
my(@listOfFiles) =
The order of sorting is O(nlgn) (I think perl uses quicksort). Finding the
maximum or minimum in a list can be done
in O(n) time. This being the case sorting the files by age is not the best
solution.
All that needs to be done here glob through the directory (perldoc -f glob) and
apply the -A or
Tried posting to the cgi list, but no success...
Anyway, maybe you can help? Have a web form reading in details, and then
mailing the contents of the form elements. When the contents contain ",
' or other special characters, they get "escaped" out in the subsequent
mail and any further lis
thx...but do you know how can sort increasingly or
decreasingly ???
I read the doc in perl.com but done find any thing about it.
thx again.
>$a and $b are built-in variables used for 'comparison criteria' during the
>sort process.
>
>The statement you have posited means that the contents of @fi
When you say sort($a cmp $b) it sorts ascendingly. When you say sort{$b <=>
$a) it sorts descendingly.
Cheers,
Rex
-Original Message-
From: nafiseh saberi [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 7:48 AM
To: Rex Arul
Subject: thx
hi.
I am from Iran...
thx...but do you
I am using CGI only to get the data sent to the script from my html
forms.
each variable is stored in a variable $IN::variablename
When I put use CGI, does it "load" all the module?? If yes, since I am
using only this feature, can I add something only to load this sub, or
is there another sub on
I'm running a command similar to the following:
open ( LOG, "/tmp/log");
autoflush LOG 1;
print LOG `/path/to/2hour/process`;
close (LOG);
This doesn't generate the expected results, ie, I don't get any output until
the end.
Any ideas on how to get the output part way through? Splitt
Any Docs with Examples..Please...
Thanks
With Warm Regards
Raju
--
From: Curtis, Graeme A [SMTP:[EMAIL PROTECTED]]
Sent: Monday, October 29, 2001 5:43 PM
To: 'Veeraraju_Mareddi'
Subject: RE: Can we Access MDB databa
>The order of sorting is O(nlgn) (I think perl uses quicksort).
>Finding the maximum or minimum in a list can be done
>in O(n) time. This being the case sorting the files by age
>is not the best solution.
Just to keep the records straight,
@sortedFiles = sort{ -M $a <=> -M $b} @files;
is a
I believe the format of the javascript open method should be:
Also, you don't need to put the tags around the tag
Dave Merritt
[EMAIL PROTECTED]
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, October
On Oct 29, Kingsbury, Michael said:
>open ( LOG, "/tmp/log");
>autoflush LOG 1;
>print LOG `/path/to/2hour/process`;
>close (LOG);
>
>This doesn't generate the expected results, ie, I don't get any output until
>the end.
That's because `...` doesn't return any input until the process
finishes.
> -Original Message-
> From: Maxim Goncharov [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, October 27, 2001 1:30 PM
> To: [EMAIL PROTECTED]
> Subject: please help with fork
>
>
> HI everyone,
>
> I need help with understanding what is happening when I fork a
> process.Here is actual co
You will be loading up more than you need by using CGI. Here are my two
suggestions:
1. CGI_Lite contains all the functions necessary to process and decode WWW
forms and cookies:
http://search.cpan.org/search?dist=CGI_Lite
2. If you'd like to play around with something new, try my Apache::Emul
> -Original Message-
> From: Joe Echavarria [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, October 28, 2001 7:02 PM
> To: [EMAIL PROTECTED]
> Subject: Flat File
>
>
> Hi there,
>
>I have a flat file with the follwoing structure :
>
> city|name|phone|zip.
>
>The script save each
> -Original Message-
> From: nafiseh saberi [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 3:39 AM
> To: perl
> Subject: PACK !!??
>
>
> hi all...
> do you know that the function "pack " in perl , work with
> which of data structure ???
> (e.g : work with array or stack or
> -Original Message-
> From: Dolfen, Stefan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 3:44 AM
> To: 'Neil Fryer'
> Cc: '[EMAIL PROTECTED]'
> Subject: AW: newbie : how to find the latest file in a directory
>
>
> I thought this is a perl mailinglist, not a unix
> I
On Mon, 29 Oct 2001 11:15:19 +1030
"Daniel Falkenberg" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a small CGI script here that is used to change users Unix
> passwords. Now before we go into security let me just tell you that the
> script is only accessable via a user name and password. T
Ok, I give up. How do I install a new module?
I am using Activeperl 5.6 (Build 631) and have downloaded a module
Win32:AdminMisc. This is not one of the modules you can install simply using
ppm.
There are some instruction on installing this module but they do not work
for this version of perl, di
Readers,
I've been to cpan.org site but some of the pages are not appearing.
what does Math::BigInt do in the following perl line?
$amount= Math::BigInt ->new("$posted_amount");
tia,
Frank
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
> -Original Message-
> From: Frank Newland [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 11:57 AM
> To: [EMAIL PROTECTED]
> Subject: Math::BigInt
>
>
> Readers,
>
> I've been to cpan.org site but some of the pages are not appearing.
> what does Math::BigInt do in the follo
--- Frank Newland <[EMAIL PROTECTED]> wrote:
> Readers,
>
> I've been to cpan.org site but some of the pages are not appearing.
> what does Math::BigInt do in the following perl line?
>
> $amount= Math::BigInt ->new("$posted_amount");
>
>
> tia,
>
> Frank
>
> --
> To unsubscribe, e-mail
Hi ...
How i use a external library in PERL ??
I need call some librarys writen in C language ...
Thanks ...
Gregory
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Etienne
Marcotte) wrote:
> I am using CGI only to get the data sent to the script from my html
> forms.
>
> each variable is stored in a variable $IN::variablename
>
> When I put use CGI, does it "load" all the module??
you might want to look
Mcgregory Pinto wrote:
>
> Hi ...
>
> How i use a external library in PERL ??
> I need call some librarys writen in C language ...
Read perldoc perlxstut.
http://www.perldoc.com/perl5.6.1/pod/perlxstut.html
Or use Inline::C
http://search.cpan.org/search?dist=Inline
Read also Pathologically Po
Hi , I posted a question earlier today regarding stripping slashes from
variables. The problem arises when we gather info from a web form and
the user input contains quotes ( " or ' ) . When the string is then used
at a later stage ( mailed or echoed to screen) , the quotes all have \"
or
Does this do the trick?
#!/usr/bin/perl -w
use strict;
my $string=q#Strip the \'slashes\' from the \"string\" if\and\only\if
they're followed by a ' or ".#;
print "Before: $string\n";
$string=~s#\\(['"])#$1#g; # match a \ followed by either a ' or ", and
replace with just the ' or "
print "After:
nafiseh saberi wrote:
>
> thx...but do you know how can sort increasingly or
> decreasingly ???
Just use {$a cmp $b} or {$b cmp $a} for alphabetical
and {$a <=> $b} or {$b <=> $a} for numerical order.
- RaFaL Pocztarski, [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addi
Dear Friends,
I need some advice. I need to track some events happening on the Database
end, and then alert the end-clients of an event. Say for example, I submit
some data, my Perl ASP/CGI page should alert the end-user about that.
I thought about this:
a) Having a minimized Web browser window
>a) Having a minimized Web browser window, that would periodically poll the
>Server side Perl Script, which would call the database to see if such an
>event occured and then return the feedback.
This could be done with a simplistic Meta Refresh - if you're script is
located at server.com/scri
The includes are as follows:
Since the included files are text files, I don't see how they could be
trying to include a file in them. These same files are included in other
files on the website with no problem and in the same way. Does it matter how
the tables are set up. That is the only thing
I have a variable in a module that I export (e.g. @EXPORT = qw( $variable ); )
Do I have to de-reference (terminology?) it in any other modules or scripts
that include the given module (ie. $module::variable) or is there a way to
import the variable so that I can refer to it directly?
TIA
Wa
I wrote something similar to this in perl using a perl script, Oracle stored
procedures, and dbi. Basically I email certain "users" when certain
threshhold levels are met. More details on request.
Mark
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, Oc
> -Original Message-
> From: Walter Grace [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 29, 2001 3:21 PM
> To: [EMAIL PROTECTED]
> Subject: Exported variables
>
>
>
> I have a variable in a module that I export (e.g. @EXPORT =
> qw( $variable ); )
>
> Do I have to de-reference (t
Thanks for your answer Bob! 0-)
However, I already had this set up as you describe and I am getting a
"requires explicit package name" error when I try to use a variable from
the module exporting its variables.
There are two differences that I see between what I did and what you show:
hi,
I have the following string
$a =
"buy 10/23/01 100 12.625 50 25.25 \n
buy 10/25/01 100 12.625 50 25.25 \n
buy 09/1/01 100 12.625 50 25.25 \n
buy 1/23/01 100 12.625 50 25.25 \n";
I would like to sort this by the date (ie the second field) in the
above string.
So it looks like this:
$
As a note...
If I specify the variables in the 'use' statement (ie. use SI::env
qw($mysqlhost $mysqluser $mysqluser $mysqlpass $db_prefix die_error);), the
problem goes away.
I thought the idea behind @EXPORT was to not have to do that.
TIA
Walter Grace
At 05:22 PM 10/29/01 -0400, you wrote
Hi all,
I really need some help on updateing the Unix /etc/passwd file.
Basically I have a script that reads it like the following...
$file = '/etc/passwd';
my $hash_ref;
my %hash_ref;
open FILE, "$file" or die "$file: $!\n";
while ( ) {
my @list = split ':';
if($list[3] == 45) {
--- Roy Peters <[EMAIL PROTECTED]> wrote:
> hi,
>
> I have the following string
>
> $a =
> "buy 10/23/01 100 12.625 50 25.25
> buy 10/25/01 100 12.625 50 25.25
> buy 09/1/01 100 12.625 50 25.25
> buy 1/23/01 100 12.625 50 25.25
";
>
> I would like to sort this by the date (ie the se
Aack! My email client (mail.yahoo.com) has substituted all for the 'backslash' n's
with literal
newlines, thus making my code virtually unreadable. I hope this hasn't happened to
anyone else,
or what you read below may be very confusing.
--- Curtis Poe <[EMAIL PROTECTED]> wrote:
> --- Roy Pet
My sincerest apologies to everyone for resending this (again!). Apparently, yahoo's
"spell check"
function interpolates escaped characters, thus rendering my code a pile of junk. I
think I've
fixed this.
Again, sorry for the confusion and the inadvertent spam :(
--- Roy Peters <[EMAIL PROTEC
Hi all - Hope this isn't out of line, but I have been subscribed to this group for
about 6 months now, and I just want you to know it has to be the finest newsgroup in
the world. I can't believe the selfless dedication some of you have to answering
questions, often the same ones, over and over.
Hi Guys,
Got a bit of a conundrum here. I have a perl script that does various
things for any user who runs it. What I need it to do is, at the end of the
script, not only exit the script, but actually log that user out of their
shell login on the box completely.
Sounds like a weird thing to do,
The program I'm writing (my first in Perl) takes a log file and using a
regex pulls out all lines that contains certain words and writes them to a
file. Then I read in that file, seperate out the fields I want (IP address
and method), and want to eliminate the duplicates, and add a count to show
Hello
I am writing a script that will look through e-mail headers and input
information into a database bases on some rules. I am using the Message-ID field in
the mail header as input for some of the fields and am having problems with pattern
matching since some of the characters in t
Robert Thompson wrote:
> ...
>
> for (my $i = 0; $i < @mess_order; ++$i) {
> if ($mess_order[$i] =~ /^$remove$/i) {
> $pos = $i;
> }
> }
>
> ...
> There are about eighty e-mails that I am testing with, and all the ones that have
>the problem are ones with a $ in the Message-ID
Daniel Falkenberg wrote:
> ...
> which creates the hash...
>
> %hash_ref (
> 'Comment' => 'username',
> 'Comment1' => 'username1',
> 'Comment2' => 'username2'
> );
>
>
> But the problem I am having is how would I go about telling my p
Stefan Dolfen schrieb:
>
> I thought this is a perl mailinglist, not a unix
> I need a function in perl to find the latest file
>
my @files_sorted_for_time_reversed =
sort {-M $b <=> -M $a} (<*.*>);
Now $files_sorted_for_time_reversed[0] contains the oldest file in the
directory.
Of c
Wagner-David wrote:
>> I have an variable of the following format
>>
>> $i = "buy 10/23/01 50 25.25 50 25.25"
>>
>> Now, I would like to multiply the 3 and 4th fields by a factor (say 2)
>> so I get the following
>>
>> $i = "buy 10/23/01 100 50.50 50 25.25"
>
> Here is one way:
>
> $i
Hi all,
I have an array of arrays @data that I would like to take the reference of the 5th
element of the first 3 elements and put them into another array and then shorten @data
by 3. I hope that this makes sense, I am new to this and don't really know a better
way too explain it. Here is wh
Friends,
How can I persist values across method calls, without using Global
Variables? IS there kind of "static" variables and if so can any of you
provide a simple code example to prove the point?
Thanks in advance,
Rex
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
When i used to program in BASIC, I had a reference card that listed all the
instructions, variables and operators in alphabetical/numerical order. It also had
brief descriptions of usage and syntax rules.
Is something similar available for perl?
Thank you for your help!
Gary Rocco
"Brett W. McCoy" <[EMAIL PROTECTED]> writes:
> On Fri, 26 Oct 2001, David Gilden wrote:
>
>> > Sorry, I meant that to say "And it runs without 'use strict'?
>>
>> Yes the code works fine, untill I try to use strict
>
> strict is very picky... but it's a good thing to use because it
> enforc
"Brett W. McCoy" <[EMAIL PROTECTED]> writes:
> On Sun, 28 Oct 2001, Piers Cawley wrote:
>
>> > strict is very picky... but it's a good thing to use because it
>> > enforces good, clean programming practices. In Perl6, strict will be
>> > on by default, so it has been written.
>>
>> It has? Where
The program I'm writing (my first in Perl) takes a log file and using a
regex pulls out all lines that contains certain words and writes them to a
file. Then I read in that file, seperate out the fields I want (IP address
and method), and want to eliminate the duplicates, and add a count to show
On Mon, 29 Oct 2001, P.Agenbag wrote:
>
Hi , I posted a question earlier today
regarding stripping slashes from variables. The problem arises when we
gather info from a web form and the user input contains quotes ( " or ' )
. When the string is then used at a later
On Oct 29, Will Muir said:
>I have an array of arrays @data that I would like to take the reference
>of the 5th element of the first 3 elements and put them into another
>array and then shorten @data by 3. I hope that this makes sense, I am
>new to this and don't really know a better way too exp
If I were you, I'd try using && instead of "and" in your if loop:
if ($client ne $newclient && $method ne $newmethod) {
// blah blah blah
}
I'm not even sure if that will work in perl. Who knows.
Good luck,
Tyler Longren
On Mon, 29 Oct 2001 08:33:42 -0700
"Earthlink" <[EMAIL PROTECTED
Here is a simple example using an mdb file and DSN-Less connection:
#!perl
# vim:ts=4:sw=4:ai:aw:
use strict;
use DBI;
# Simple connect and select script using DSN-Less ADO connection.
my $dsn =
q{dbi:ADO:Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.\mytest.mdb};
# User and Password
I think ( and there's plenty who will tell you if I'm wrong... lol ) that
you need to put it as:
if (($client ne $newclient) && ($method ne $newmethod)) {
// blah blah blah
}
Otherwise I think it doesn't bother to look at the second if the first fails.
Hope that helps.
At 10:28 PM 10
I think you're right. ;-)
Tyler
On Mon, 29 Oct 2001 20:40:28 -0800
Dave Turner <[EMAIL PROTECTED]> wrote:
> I think ( and there's plenty who will tell you if I'm wrong... lol )
> that
> you need to put it as:
>
> if (($client ne $newclient) && ($method ne $newmethod)) {
> // blah bl
hi all..
I wrote a progarm with perl for one server..and
I want to change it to execute faster than past...
would you guide me...?
e.g:
I think if I use undef for variable is better...
what things exist in your mind..??
thx.
__
Best regards . Nafiseh
Hey All,
I have a perl script here (below) that becomes a daemon when ever I run
it. But when ever it goes to read the script it it dies on me?
Can any one tell me what is going on here?
If I remark (#) the read_config(); in the while loop the daemon doesn't
break. Does any one here have any
hi.
in this site exist many module...
http://www.sunsite.ualberta.ca/Documentation/Misc/perl-5.005_03/
__
Best regards . Nafiseh Saberi
A bird in the hand ,is worth two in the bush.
www.iraninfocenter.net
www.electronegar.com
Nafiseh,
The first rule of optimisation is:
"Don't talk about optimisation".
The second rule of optimisation is:
"Don't talk about optimisation".
The third rule of optimisation is:
"Don't optimise".
More seriously, if you're having to optimise your code to run faster, you
probably shouldn't be
>> Nafiseh wrote:
> thx a lot...
> but
> do u know that ..is it possible that router put their data
> in database and not in file...to process it faster..
>
Nafiseh,
That really depends ... databases can be faster, but then so can text files
...
o http://www.perl.com/pub/a/2001/04/10/engine.
Kurt,
> if ($client ne $newclient and $method ne $newmethod){
> print "something\n";#I'll actually be
> printing this to my report once I get this worked out
> }
I think what you want is:
if (($client ne $newclient)&&($method ne $newmethod)) { ... }
This is c
Troy,
You didn't specify what you error was ... can I suggest you thoroughly read
the docs in perlfunc about require ... http://www.perldoc.com would be a
good place to start, or even just typing 'perldoc -f require' at your
friendly neighbourhood command line.
If options.txt isn't perl code and
> What I don't yet understand is the other direction: How do I make
> individual configuration variables, taken from database.cfg, available in
> the modules or db.cgi? I guess that would be a job for "require", but am
> not sure.
You have a number of options. My prefered one is to do this:
(opt
"Gary M Rocco" said
qq! When i used to program in BASIC, I had a reference card that listed all
the instructions, variables and operators in alphabetical/numerical order.
It also had brief descriptions of usage and syntax rules.
Is something similar available for perl? !
May I suggest:
Perl 5
> o The Camel Book "Programming Perl" (3rd Edition) by O'Reilly Associates
> has a section in the back about making Perl code faster, as far as I
> remember
Second edition:
http://www.bluesreview.com/Oreilly/perl/prog/index.htm
8.3 Efficiency
http://www.bluesreview.com/Oreilly/perl/prog/ch08
When we're done with the terrorists I suggest we go after these people cheating
their unwelcome ads onto our systems and stealing our time for their selfish
purposes.
> -Original Message-
> From: Luinrandir Hernson [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, October 28, 2001 8:53 AM
> To:
Hey all,
I'm trying to open a text file, collect the file into an array called
@records. Then I'm going to write the data back out to another text file
based on a variable such as:
$sfield and $var are fed from an HTML doc.
If ($sfield == 1) {
>>open (INFILE, "> or die "Error opening
84 matches
Mail list logo