Hello,
If(keys %hash){
#do ...
}
Could you suggest an other way, please ?
Thanks in advance.
José.
DISCLAIMER
This e-mail and any attachment thereto may contain information which is confidential
and/or protected by intellectual property rights and are intended for the
C:\perldoc -q intersection
Found in C:\Perl\lib\pod\perlfaq4.pod
How do I compute the difference of two arrays? How do I compute the
intersect
ion of two arrays?
Use a hash. Here's code to do both and more. It assumes that
each element is unique in a given array:
-Original Message-
From: Konrad Foerstner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 5:25 PM
To: [EMAIL PROTECTED]
Subject: removing emty lines without creating a new file or array
Hi,
My problem today ;) : I have a file with some unmeant empty
lines and I
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 2:10 PM
To: 'Mystik Gotan'; Perl
Subject: RE: Perl Learning Paths
Helped a lot. I also have the pocket reference and find it an
indispensable tool. Perldoc seems hard to use because
-Original Message-
From: Ian Zapczynski [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 20, 2002 7:01 PM
To: [EMAIL PROTECTED]
Subject: how to use alarm() to properly time out a connection?
Hello all,
I need to use alarm to time out a connection to an SFTP server if the
-Original Message-
From: Thomas Browner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 5:20 PM
To: [EMAIL PROTECTED]
Subject: can not make html doc's
I have just installed Win32::DriveInfo and now I am trying to
install the HTML doc's, but I am getting this
http://home.san.rr.com/lanois/perl/2706_01.html
José.
-Original Message-
From: Thomas Browner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 5:17 PM
To: [EMAIL PROTECTED]
Subject: FW: remote hard drive stat
How do I go about installing the Win32-DriveInfo
http://jenda.krynicky.cz/perl/CPANppm.html
He, I just got them from Google :
http://www.google.be/search?q=install+perl+nmakeie=UTF-8oe=UTF-8hl=nlmeta=
José.
-Original Message-
From: Thomas Browner [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 5:17 PM
To: [EMAIL
Additional thought I've apprecitiated
See ==ARCHIVE
José.
==ARCHIVE
-Original Message-
From: Nigel Wetters [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 23, 2002 6:19 PM
To: [EMAIL PROTECTED]
Subject: Re: Perl vs. PHP?
PHP is a good templating language, similar to ASP, JSP,
#!/usr/bin/perl
use strict;
use Benchmark;
sub using_aref{
my $aref=[];
@$aref=(1,2,3,4,5);
return $aref;
}
sub using_array{
my @array=();
@array=(1,2,3,4,5);
return \@array;
}
And the winner is :
timethese (100,{ using_aref =
Have you checked CPAN ? http://search.cpan.org/
José.
-Original Message-
From: Paul Kraus [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 5:52 PM
To: 'Perl'
Subject: Excel
Is it possible to insert data into an excel file using Perl?
If so can you point me to some
$oSheetCR-Value #formatted value
$oSheetCR-{Val} #original value
José.
-Original Message-
From: Max [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 10, 2002 4:50 PM
To: [EMAIL PROTECTED]
Subject: Spreadsheet::ParseExcel date problem (year is being
reformatted)
When I read
Give a look to this archive:
http://archive.develooper.com/beginners%40perl.org/msg37783.html
HTH,
José.
-Original Message-
From: andres finlandes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 12, 2002 12:18 PM
To: [EMAIL PROTECTED]
Subject: No DB::DB routine defined
perldoc -q PACKAGE
José.
-Original Message-
From: Trond Hagen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 11, 2002 7:09 AM
To: [EMAIL PROTECTED]
Subject: Which package am I in ?
Hi!
I want to know which package I'm in?
Any help?
package go
print Now I'm
An other option is to check first the FAQ:
1) FAQ from this list
http://learn.perl.org/beginners-faq
2) FAQ from perldoc
perldoc -q key words
Type
perldoc perldoc
For more info.
HTH,
José.
-Original Message-
From: Rob Richardson [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December
There are some modules
from CPAN (http://search.cpan.org/) you can use.
I would suggest:
1. Net::Daemon
http://search.cpan.org/author/JWIED/Net-Daemon-0.37/lib/Net/Daemon.pm
2. give a look to Net::Server as well, for general purpose.
-Original Message-
From: Michael Kelly [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 28, 2002 9:20 PM
To: Perl Beginners List
Subject: Re: HELP W. Print
On Thu, Nov 21, 2002 at 04:57:03PM -0200, [EMAIL PROTECTED] wrote:
Hi,
Hi,
How do i solve this
Say i have an
For such simple class (no inheritance ...), you can just
use the standard module Class::Struct,
it will built constructor and accessors for you.
Then like Paul said :
Just write a method (called 'init' in the example below)
which accepts the string,splits on the semi-colon,
and assigns the result
If you want your loop to first finish
what he is doing before die, do this instead.
Thus,when you receive the alarm sig you exit
first the loop then the script.
#!/usr/bin/perl -w
use strict
my $time_to_die=0;
my $sleep=5; #in seconds
my $timeout=3600; #in seconds
$SIG{ALRM} = sub {
-Original Message-
From: david [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 27, 2002 8:34 PM
To: [EMAIL PROTECTED]
Subject: RE: how do i make a script run for a certain period of time?
Nyimi Jose wrote:
If you want your loop to first finish
what he is doing before
perldoc -f do
José.
-Original Message-
From: Johnstone, Colin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 26, 2002 7:58 AM
To: '[EMAIL PROTECTED]'
Subject: Help perl gurus
Gidday all,
I have written what I will refer to as an include file ( php
speak ) and named it
-Original Message-
From: jeff loetel [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 22, 2002 9:01 AM
To: Perl beginners
Subject: eval and alarm timeout for slow process (XML post)
Does this look correct below. I know that I should test but
due to the environment that this
-Original Message-
From: Brian Ling [mailto:brian.ling;bbc.co.uk]
Sent: Monday, November 04, 2002 4:17 PM
To: [EMAIL PROTECTED]
Subject: Variable names
Hi all
Is it possible to use the string value of a variable to
create a new hash i.e.
My $name = fred;
Can I use
Try this:
#!/usr/bin/perl
use strict;
my $file=$ARGV[0];
open(FH,$file) || die can not open file named $file for reading\n;
#Init stuff
my $current_line=FH;
my ($from,$prev_key)=split /\s+/,$current_line;
my $prev_to=$from;
#Go
while($current_line=FH){
my
You can use symbolic references:
perldoc perlref
(see Symbolic references section)
$i=0;
While(bla bla){
$i++;
$a_var_name=array$i;
$h_var_name=hash$i;
#
@$a_var_name=(); #this for instance clears @array1 if your are in the first
loop.
http://lists.perl.org/showlist.cgi?name=perl-xml
José.
-Original Message-
From: Melanie Rouette [mailto:mrouette;omnisig.com]
Sent: Tuesday, October 22, 2002 10:04 PM
To: [EMAIL PROTECTED]
Subject: XML perl mailing list
Hi,
How do I subscribe to the perl xml mailing list?
Totally aggree with you Nigel.
To complete, some of you may give a look to :
http://www.perl.com/pub/a/2001/06/05/cgi.html
Which uses a clear separation between the 3 layers mentioned by Nigel.
José.
-Original Message-
From: Nigel Wetters [mailto:nigel.wetters;rivalsdm.com]
Sent:
Use PHP Smarty if you want to separate application logic and presentation logic.
See : http://smarty.php.net/manual/en/what.is.smarty.html
José.
-Original Message-
From: NYIMI Jose (BMB)
Sent: Wednesday, October 23, 2002 6:32 PM
To: Nigel Wetters; [EMAIL PROTECTED]
Subject: RE
Yes !
use Shell::Source module
http://search.cpan.org/author/PJCJ/Shell-Source-0.01/Source.pm#SYNOPSIS
José.
-Original Message-
From: Zielfelder, Robert
[mailto:robert.zielfelder;tycoelectronics.com]
Sent: Monday, October 21, 2002 4:51 PM
To: Perl Beginners List (E-mail)
The above modules are based around the expat libraries. There
are also modules based around the gnome libxml2 libraries,
which seem to be faster, but less portable:
It seems that you must be root to install libxml2 libraries, right ?
while expat libraries offer more flexibility with the
It depends on how big,complex,validation required(via DTD) or not... is your XML.
Start looking from following modules:
XML::Simple
XML::DOM
XML::Parser::PerlSAX
José.
-Original Message-
From: Admin-Stress [mailto:meerkapot;yahoo.com]
Sent: Monday, October 21, 2002 5:49 PM
To:
, October 21, 2002 6:18 PM
To: NYIMI Jose (BMB)
Cc: Admin-Stress; perl
Subject: RE: XML module
On Mon, 2002-10-21 at 17:04, NYIMI Jose (BMB) wrote:
XML::Simple
XML::DOM
XML::Parser::PerlSAX
The above modules are based around the expat libraries. There
are also modules based around
Try this to load the code at run-time:
eval require $some_module;
if($@){
die $@;
}
José.
-Original Message-
From: Reinstein, Shlomo [mailto:shlomo.reinstein;intel.com]
Sent: Thursday, October 17, 2002 8:57 AM
To: 'Jenda Krynicky'; [EMAIL PROTECTED]
Subject: RE: How to
What about this:
sub new {
my $class = shift;
$class = ref $class if ref $class;
my %args = @_;
my $self = bless { }, $class;
# needs hierarchical initialization here
$self-SUPER::initialize(%args);
José.
DISCLAIMER
This e-mail and any
$system_results = system(usr/bin/ptal-pml hpjd:$ip get-$type
$value);
I'm not sure if my suggestion will work :)
but let try to use a pipe like this:
open(PIPE,usr/bin/ptal-pml hpjd:$ip get-$type $value |) #note the | character at the
end.
|| die open pipe failed! : $!\n;
$var=~s/\%0D\%0A/\n/g
José.
-Original Message-
From: Wim [mailto:wdh;belbone.be]
Sent: Friday, October 18, 2002 3:57 PM
To: [EMAIL PROTECTED]
Subject: [Storing CR in variable
Hello,
I have a memofield on a HTML page. I need to insert it in a
database. The CGI-script
If you're using notepad or wordpad, hold down alt and type
0169 (on the
keypad) and you'll get the symbol as a literal. Put it in
quotes, and it'll work fine.
I think, he wants to print out the copyright symbol to a file from a
perl script.
If that is question then the syntax below will do
Use FindBin module.
The advantage is that FindBin module belongs to standard distribution
Your some_path/lib/sos.pl script will look like:
#!/usr/bin/perl -w
use strict;
use FindBin qw($Bin) # so $Bin contains your some_path/lib
#from here TMTWOTDI, one way is to pick up some_path from $Bin
my
Use FindBin module.
The advantage is that FindBin module belongs to standard distribution
Your some_path/lib/sos.pl script will look like:
#!/usr/bin/perl -w
use strict;
use FindBin qw($Bin) # so $Bin contains your some_path/lib
#from here TMTWOTDI, one way is to pick up some_path from $Bin
my
use Tie::File;
tie @array, 'Tie::File', file.txt or die $!;
my $last_line=$array[$#array];
José.
-Original Message-
From: alex chen [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 11, 2002 8:57 AM
To: [EMAIL PROTECTED]
Subject: how to get the last line of a file
hi, all
Just a idea :
#!/usr/bin/perl -w
use strict;
my $old_file=address.txt;
open(OLD,$old_file) || die can not open $old_file for reading: $!;
while(OLD){
s/\#(.+)$/Apt $1/ if /.ADDRESS\s+1/;
print;
}
__END__
José.
-Original Message-
From: Zary Necheva [mailto:[EMAIL
That's mainly because you are using Perl interpreter that has been installed with cc.
One solution is to re-install your Perl using gcc (doesn't take much time ) then
install DBI.
José.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday,
This problem has been dicussed in the dbi-users maillist.
Perl mail list database: http://lists.perl.org/
Search: http://groups.google.com/advanced_group_search
Seach on gcc gives :
http://groups.google.com/groups?as_q=gccsafe=imagesie=UTF-8oe=UTF-8as_ugroup=*dbi-userslr=hl=en
José.
my 2 cents...
Distributed GUI apps are legacy. Write web based software.
You right !
That's what I was thinking about ...
Do you have some reasons in which case Distributed GUI will be the winner against
Browser Client ?
Should I continue learning Perl/Tk then ? :-)
José.
Why not just use Tie::File module ?
http://search.cpan.org/author/JHI/perl-5.8.0/lib/Tie/File.pm#SYNOPSIS
José.
-Original Message-
From: Hello Buddy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 11:29 AM
To: [EMAIL PROTECTED]
Subject: I need help for handling text
The Browser's interface cannot contain all the features and rings
and bells a normal GUI can (unless you use Java and use the browser
just to download and host the application)
What about Perl for the aforementioned functionality.
It's seems that Java is the Guru in GUI matters ? :(
José.
Hello,
I start (3 days ago) learning: Writing GUI with Perl.
I bougth the book Mastering Perl/Tk from Oreilly : hope made a good choice :-)
My question is:
Once I develop my Application(GUIs) and so one, how to deploy it to users ?
If my users are using PC (Windows OS) and they don't Perl
-Original Message-
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 30, 2002 10:05 AM
To: [EMAIL PROTECTED]
Subject: Re: Finding if a module is already 'require'd
Ramprasad A Padmanabhan wrote at Mon, 30 Sep 2002 09:36:50 +0200:
How do I find in a
set PERL5LIB environment varible to
/tmp/foo then you will be able to use 'use BAR;'
Or give a look at
'perldoc lib'
José.
-Original Message-
From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 30, 2002 2:53 PM
To: [EMAIL PROTECTED]
Subject: Can I
-Original Message-
From: david [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 8:41 PM
To: [EMAIL PROTECTED]
Subject: Re: Hide a string while saving it to file
Nyimi Jose wrote:
I have a string (ascii).
I would like to apply a rule on it before saving it to
I'm trying to install perl modules (DBI actually ...) for windows using
PPM.
My connection is via proxy and I have set HTTP_proxy , HTTP_user and
HTTP_pass variables ...
When I type the ppm command : search *
I got the following messages:
Searching in repository 1 (ActiveState Package
I have a string (ascii).
I would like to apply a rule on it before saving it to a file - coding ...
And apply the same rule to get the original string while reading from the file -
decoding ...
Any Idea ?
Thanks,
José.
DISCLAIMER
This e-mail and any attachment thereto may contain
Give a look to File::Basename module.
http://search.cpan.org/author/JHI/perl-5.8.0/lib/File/Basename.pm
José.
-Original Message-
From: Henry Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 23, 2002 9:17 AM
To: [EMAIL PROTECTED]
Subject: Re: Filename modification
use a special forking form of open :
The open function, when passed as its second argument either -| or
|- will implicitly pipe and fork. This makes the piping code above
slightly easier. The child talks to the parent over STDIN or STDOUT,
depending on whether -| or |- was used.
Example ( Not
excellent but do i have to re-write the server for this to work?
i need a client that will connect, and upon recieving a certain work from the
server ...
You said: ... upon receiving a work ...
So that means your client is also a kind of server.
Otherwise, I don't know how it will be
Type the command line:
perldoc -f exec
José.
-Original Message-
From: Willem Pretorius [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 2:28 PM
To: [EMAIL PROTECTED]
Subject: exec()
Hi all
Can anyone give me an example of how to use the exec()
command in a
I rewrite our code like this and it works !
#!/usr/bin/perl
use strict;
my @array;
my $count = 0;
my $maxCount = 1;
while ($count $maxCount){
$count++;
my $myHash = getHash;
foreach my $key (keys %$myHash )
{
print THIS WORKS: $key $myHash-{$key}\n;
}
-Original Message-
From: pravesh biyaNI [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 3:56 PM
To: [EMAIL PROTECTED]
Subject: how to initialise a two dimensional array
Hi
I am using a two dimentional array!! but the script on
running gives
an error
You made a very good choice !.
I have this book and learned a lot from it.
As said, there is a refresh chapiter about basics on Perl so don't waste a lot time
by starting with Learning Perl book and fourth ...
Just go ahead Object Oriented Perl since you are familiar with OO concepts.
José.
You can also store your complexe data structures in a xml file by using XML::Simple
module.
http://search.cpan.org/author/GRANTM/XML-Simple-1.08/Simple.pm
José.
-Original Message-
From: Rowan Reid [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 8:39 PM
To: 'Perl
A second loop:
foreach $KEYS ( keys %Data){
print Key1 data :\n;
map{ print $_,\n } @{$Data{$KEYS}{key1}};
}
José.
-Original Message-
From: Marija Silajev [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 2:43 PM
To: Perl
Subject: printing hash of a hash
Slice is simple and also faster !
Look:
#!/usr/bin/perl
use strict;
use Benchmark;
my @a=qw(a c b c a a b d c c);
my @uniq=();
sub using_grep{
my %seen=();
@uniq=sort grep{ ! $seen{$_}++ } @a;
}
sub using_slice{
my %h=();
@h{@a}=();
@uniq=keys %h;
}
(n=100)
José.
-Original Message-
From: NYIMI Jose (BMB)
Sent: Friday, August 30, 2002 9:07 PM
To: Felix Geerinckx; [EMAIL PROTECTED]
Subject: RE: uniq elements of an array
Slice is simple and also faster !
Look:
#!/usr/bin/perl
use strict;
use Benchmark;
my @a=qw(a c b c a a b
I need to redirect STDOUT and SDTERR to a predefined logfile.
I wrote this so far:
$log_full_name and open (STDOUT,$log_full_name) or warn can not redirect STDOUT to
$log_full_name : $!\n);
open (STDERR,STDOUT) or warn can not redirect STDERR : $!\n);
May I ask to review this code and suggest
perldoc GetOpt::Long
Example:
#!/usr/local/bin/perl -w
use strict;
use Getopt::Long;
my $var='';
GetOptions('unreserved' = \$var);
print coucou\n if($var);
__END__
HTH,
José.
-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 8:56 AM
To:
What you mean by deep copy ?
Be more clear :-)
José.
-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 3:40 PM
To: Beginners (E-mail)
Subject: Deep copy
Hey anyone have the link handy that explained deep copying and had the simplest
perldoc -f require
Example:
$filename=/home/me/lib/Foo.pm;
eval require $filename;
HTH,
José.
-Original Message-
From: RAHUL SHARMA [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 10:37 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Dymanically use
Hi All,
I
Oh yes !
The magic Tie ...
Enjoy!
José.
-Original Message-
From: Janek Schleicher [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 5:45 PM
To: [EMAIL PROTECTED]
Subject: Re: printing to the top of a file
Stephen Redding wrote at Fri, 09 Aug 2002 10:54:01 +0200:
I have a
Try this:
@files=glob(/sybase/dba/scripts/dbuser_report/*);
unlink(@files);
HTH,
José.
-Original Message-
From: loan tran [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 30, 2002 6:44 PM
To: [EMAIL PROTECTED]
Subject: empty a dir
Is there a better way to do this in perl:
$reportdir
Hello,
I would like to clean up my logfile directory by removing files that are older than 7
days.
So I wrote something like:
/user/local/bin/perl -w
use strict;
use FindBin qw($Bin);
#
`find $Bin -mtime +7 -name '*.log' -exec rm {} \;`;
#
__END__
My question is: how can I use perl's synthax
PROTECTED]; NYIMI Jose (BMB)
Subject: Re: Avoid using backticks
You should be able to do it with
opendir (to open directories and browse the contents)
and
unlink (to delete files)
take a look at the man pages for those two to get you started, if you're still
struggling just ask again.
HTH
Thanks George,
I will try ...
José.
-Original Message-
From: George Schlossnagle [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 29, 2002 10:27 AM
To: NYIMI Jose (BMB)
Cc: [EMAIL PROTECTED]
Subject: Re: Avoid using backticks
You can use the File::Find module. It even has a find2perl
201 - 272 of 272 matches
Mail list logo