[11849] in Perl-Users-Digest
Perl-Users Digest, Issue: 5449 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 22 06:07:26 1999
Date: Thu, 22 Apr 99 03:00:23 -0700
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, 22 Apr 1999 Volume: 8 Number: 5449
Today's topics:
Re: ANNOUNCE: PFR Reopened :-) <dgris@moiraine.dimensional.com>
Any free CGI hosting allow running similar to UNIX ? <austin95002887@yahoo.com>
Re: attach a subroutine to a filehandle (Bart Lateur)
DBD::ODBC and MS SQL server <cheldwein@_NO-SPAM_csi.compuserve.com>
Re: DJGPP Port for DOS (Was Re: for (my $i;;) doesn't w (Bart Lateur)
Re: Generating a unique string for order number smnayeem@my-dejanews.com
how can i extract a file send in a mail ? mikl_paris@my-dejanews.com
how can i extract an attach file in a mail ? mikl_paris@my-dejanews.com
How to create a user account in solaris alexpo@my-dejanews.com
Re: How to create a user account in solaris <Michael.Cameron@no.spam.technologist.com>
Re: How to make an array name to be a variable? <staffan@ngb.se>
Is there a shorter way? pingouino@my-dejanews.com
Perl & CGI Sites Needed <spmedia@earthlink.net>
Re: Perl 'split' function in C?? ()
Re: Perl vs. OTHER scripting languages ? When/Why to us (Yossarian)
Re: Perl vs. OTHER scripting languages ? When/Why to us <glg@apk.net>
Perl2exe doesnt work on modules agniora@usa.net
Please, HELP with uninitialized value error <p.brouwer@prevalent.nl>
Re: Please, HELP with uninitialized value error <Michael.Cameron@no.spam.technologist.com>
Problem installing Date::Calc on linux agniora@usa.net
Re: Prombles storing multidimensional array in a file (Arved Sandstrom)
Q: I cannot install Sybperl 2.1 on Redhat 5.2.. Why? <pitecus@tronage.com>
Re: Q: I cannot install Sybperl 2.1 on Redhat 5.2.. Why <Michael.Cameron@no.spam.technologist.com>
Re: remove space (Larry Rosler)
Re: Script to tidy/format a C file <myke98@my-dejanews.com>
Re: scriptlet to add line breaks at even multiples? (David Cantrell)
Sort function <idaham@mimos.my>
Re: Sorting Hashes of Arrays.... <kelly@pcocd2.intel.com>
weird difference between exec and system (Eric Smith)
What is Perl module ? <austin95002887@yahoo.com>
Re: What is Perl module ? <Michael.Cameron@no.spam.technologist.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Apr 1999 00:17:24 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: ANNOUNCE: PFR Reopened :-)
Message-Id: <m3k8v59o23.fsf@moiraine.dimensional.com>
[clp.moderated trimmed from newsgroups]
Daniel Grisinger <dgris@moiraine.dimensional.com> writes:
> I've managed to recover somewhat from last month's disk
> failure, and the Perl Function Repository is once again
> up and running at
> <URL:http://moiraine.dimensional.com/~d
uh-oh, the announcement was corrupted. :-(
the correct url is
http://moiraine.dimensional.com/~dgris/perl/pfr/
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Thu, 22 Apr 1999 15:06:58 +0800
From: "Austin Ming" <austin95002887@yahoo.com>
Subject: Any free CGI hosting allow running similar to UNIX ?
Message-Id: <7fmhpr$2d9$1@justice.csc.cuhk.edu.hk>
Any free CGI hosting allow running similar to UNIX ?
I really don't want to run CGI using FTP uploading!
I want to run CGI and learn more it in UNIX environment.
------------------------------
Date: Thu, 22 Apr 1999 09:20:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: attach a subroutine to a filehandle
Message-Id: <371ee681.5958813@news.skynet.be>
[posted and mailed] Corey Saltiel wrote:
> Is it possible to 'return' STDOUT into an array ( or something ) so
> I can step through it line-by-line, like what one would do with a
> filehandle?
>
>#!/usr/bin/perl
>@output = ( print "a few\nlines worth\nof\nstuff\n" );
>
>foreach $value (@output) {
> print("line is \"$value\"\n");
>}
>
>
> What I'd *like* to see returned here is:
>
>line is "a few"
>line is "lines worth"
>line is "of stuff"
>
>
> But what I get instead is:
>
>a few
>lines worth
>of
>stuff
>line is "1"
> What do I got to do here? -- please refer me to any documentation,
> I'm sure I've managed to miss this particular ( simple ) feat in
> the docs somewhere.
perldoc perltie -- in partuicular, look for the "shout" example.
Here's an example I just wrote, for a tied filehandle that just writes
to a particular filehandle (either the filehandle of the typeglob you
pass, or the currently selected output filehandle if none is passed),
and logs the data in an array as well. It's not exactly the format
you're looking for, but it's a start. You'd need to split on /\n/, or do
{ @lines = /.*\n?/g } or something similar.
Note that tie() is used *instead* of open(), and untie() instead of
close(). After the script has run, look at the created file
"logged.txt". BTW the script is all one file.
#!/usr/local/bin/perl -w
open FILE,">logged.txt" or die "Can't open file: $!\n";
my $logged = tie *LOGGED,'Tiehandle::Pushed',*FILE;
# Alternatively, try:
# my $logged = tie *LOGGED,'Tiehandle::Pushed'; # -> STDOUT
{ # print
local($,,$\) = ('; ',undef);
print LOGGED "This is A\n";
print LOGGED "This is B","and C\n";
print LOGGED "That's it.\n";
}
print STDERR "Result:\n",@{$logged->{data}};
undef $logged; # prevents "the untie gotcha"; see docs
untie *LOGGED;
package Tiehandle::Pushed;
sub TIEHANDLE {
my($class) = shift;
my $handle = shift || select;
print STDERR "Start logging\n";
return bless { array => [], handle => $handle },$class;
}
sub PRINT {
my($self,@data) = @_;
local $^W;
push @{$self->{data}}, join($,,@data).$\;
my $handle = select $self->{handle};
print @data;
select $handle;
}
sub DESTROY {
print STDERR "End logging\n";
}
__END__
Bart.
------------------------------
Date: Thu, 22 Apr 1999 11:37:09 +0200
From: Christian Heldwein <cheldwein@_NO-SPAM_csi.compuserve.com>
Subject: DBD::ODBC and MS SQL server
Message-Id: <371EEDC5.6E8330F6@_NO-SPAM_csi.compuserve.com>
Hi,
I'm having trouble with Perl's DBD::ODBC package under Linux RedHat 5.1.
Used files: DBI-1.06, DBD-ODBC-0.20, libiodbc-2.50
What I've done so far:
1) Got DBI, compiled and installed it. (It works fine with DBI::Pg and
PostgreSQL up to now)
2) Now I must connect to MS SQL 6.5 databases. In a DBI/DBD readme file
there was something mentioned about using DBD::ODBC.
3) I got this package and read the README file, where I read that I have
to get an ODBC driver manager and in the case, that I do not have one
(is there one for the MS SQL server 6.5?) , I should try to use the
iODBC package in the (included) iodbcsrc directory.
But: It looks like there are a few files (e.g. Config.mk which is
included in the Makefile) missing in this archive.
4) I got libiodbc-2.50 and compiled it - ok. I copied the library
libiodbc.so to /usr/local/src/libiodbc-2.50 where the source of libiodbc
is installed.
5) Back to DBD::ODBC: I tried perl Makefile.PL -o
/usr/local/src/libiodbc-2.50. I got a message, that this looks like a
iodbc type of driver manager and it expects to find isql.h, isqlext.h
and iodbc.h. Once again, there is a missing file (iodbc.h is NOT
included in the libiodbc-2.50.tar file, but it is included in the
iodbcsrc tree of DBD::ODBC. This is getting really strange.). I have
copied iodbc.h to the /usr/local/src/libiodbc-2.50 directory.
6) perl Makefile.PL -o /usr/local/src/libiodbc-2.50 reports now, that
there was no library found for
-l/usr/local/src/libiodbc-2.50/libiodbc.so. Very strange.
Is there an error in the Makefile.PL ?
Line 134:
====================
else {
# remove lib prefix and .so suffix so "-l" style can be used
$ilibname =~ s/^lib(iodbc.*?)\.\w+$/$1;
$opts{LIBS} = "-L$odbchome -l$ilibpath";
...
====================
Hmm, we are removing the lib prefix but we are not using it then ?! I
replaced the last line with this one:
$opts{LIBS} = "-L$odbchome -l$ilibname";
7) Now I have no errors left. The environment variables DBI_DSN,
DBI_USER and DBI_PASS were set to their appropriate values.
8) make and make install produced no errors.
9) The .odbc.ini file containes the following:
======================
; odbc.ini
;
[ODBC Data Sources]
OpenLink = OpenLink (MT)
[MSSQL]
Driver = /usr/local/src/libiodbc-2.50/libiodbc.so.2
Description = Sample MS SQL connection
Host = host ip address
Server Type = Microsoft SQL
UserName = Username
Password = password
Database = db
[Default]
Driver = /usr/local/src/libiodbc-2.50/libiodbc.so.2
======================
10) $dbh = DBI->connect("dbi::ODBC::MSSQL") produces a core dump of
about 12MB :-(
Does anybody have any hints for me, how I can get this working ? It
would be really appreciated.
ciao
Christian
------------------------------
Date: Thu, 22 Apr 1999 07:12:42 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: DJGPP Port for DOS (Was Re: for (my $i;;) doesn't work like I think it should)
Message-Id: <371eca66.1759522@news.skynet.be>
Jonathan Stowe wrote:
>Yes 5.005.02 is the version that is currently available from the djgpp
>archives.
How bizarre. I paid a visit to CPAN. The only binary distribution there
is still 5.004. It does say, however:
> Starting from Perl 5.005 the MS-DOS support has been integrated to the
> Perl standard source code distribution.
So everybody has to build their own binary now? Even if they end up with
the SAME binary, all over the world?
Then I went to ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/ and
there it is: perl552b.zip (2448 kb). Oh, and the source code is there
too, if you want it: perl552s.zip, 3775 kb.
I thought CPAN was supposed to be the main distribution?
Bart.
------------------------------
Date: Thu, 22 Apr 1999 06:02:59 GMT
From: smnayeem@my-dejanews.com
Subject: Re: Generating a unique string for order number
Message-Id: <7fme2i$mco$1@nnrp1.dejanews.com>
In article <371E7FFB.55FB2A33@well.com>,
Greg McCann <gregm@well.com> wrote:
> I'm working on an e-commerce application where I would like to generate a
> unique, mostly numeric string for a new order number.
>
> Here are some of the possibilities I have considered. I don't think that any
of
> these alone are sufficient but combining two of them may give me something
close
> to what I want. I would appreciate any suggestions or insights into this
> problem.
>
> time - I think this is a good start, but not to be used alone since two
> customers may submit an order at the same time (within the same second).
>
how about addint a user_no to the time to make it unique. u just need to
determine whats the maximum number of users that can register in a certain
time and adjust the size of this field accordingly
agniora
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 08:53:44 GMT
From: mikl_paris@my-dejanews.com
Subject: how can i extract a file send in a mail ?
Message-Id: <7fmo2n$vc3$1@nnrp1.dejanews.com>
when i used the mailsender module i don't know how can i extract an attach
file, to move it in a directory.
please help me
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 08:56:45 GMT
From: mikl_paris@my-dejanews.com
Subject: how can i extract an attach file in a mail ?
Message-Id: <7fmo8d$vf3$1@nnrp1.dejanews.com>
use Mail::Sender;
($base=$0)=~ s/[A-z0-9,\.,\-]*$//;
chdir $base;
$sender = new Mail::Sender
{smtp => 'xxxx.thomson-csf.com', from => 'xxx@xxx.thomson-csf.com'};
$sender->MailFile({to => 'xxx.xxx@tfm.thomson-csf.com',
subject => 'test',
msg => "it's a test",
file => 'c:/mikl/mikl/resultat_mois.txt'});
print "mail sent";
i want to extract this file in order to move in a directory
thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 07:40:43 GMT
From: alexpo@my-dejanews.com
Subject: How to create a user account in solaris
Message-Id: <7fmjpr$s2u$1@nnrp1.dejanews.com>
Hi,
i was wondering if anyone can tell me how to either create a new user from a
telnet login or from a sh script. I need that, so once a user enters his
information, i can either open a telnet session and enter the comandline or i
can ftp a script file to the server and with cron check every 5 minutes if
there is a new file, if so exec sh file and the delete.
I need to be able to set the folowing things for user, username,password,
homedir. Also, if i use a command line, will this also create the homedir ??
hope someone can point me in the right dir.
Thanks
Alex
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 09:06:52 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: alexpo@my-dejanews.com
Subject: Re: How to create a user account in solaris
Message-Id: <371EE6AC.7E8C3274@no.spam.technologist.com>
alexpo@my-dejanews.com wrote:
> i was wondering if anyone can tell me how to either create a new user from a
> telnet login or from a sh script.
man useradd
man passwd
> I need that, so once a user enters his information, i can either open a telnet
> session and enter the comandline or i
> can ftp a script file to the server and with cron check every 5 minutes if
> there is a new file, if so exec sh file and the delete.
?????
> I need to be able to set the folowing things for user, username,password,
> homedir. Also, if i use a command line, will this also create the homedir ??
Yes if you if you use the command line correctly
> hope someone can point me in the right dir.
Not here mate. This has *nothing* to do with perl. Have you tried
comp.unix.shell or some other related group? I really have no idea what your
intentions are from your description above.
Michael
------------------------------
Date: Thu, 22 Apr 1999 10:30:31 +0200
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: How to make an array name to be a variable?
Message-Id: <371EDE27.E36E1B47@ngb.se>
Uri Guttman wrote:
[ a lot of stuff ]
I just have to say that it's funny how close all the guru's are to a
nervous breakdown on this issue.
I just want to say to some of you (speaking as your self-appointed
therapist): You aren't responsible for the agony of all the newbie
programmers get from using symbolic refs. Let go of the guilt. If you
get upset by the stupidity of a post, don't answer. Or do like Abigail.
Give them a "FAQ" and feel much better afterwards. And put down that
rifle.
Personally, I think hashes are gods greatest gift to the programmer. I
love them. If I could turn my wife into one, I would.
Staffan
------------------------------
Date: Thu, 22 Apr 1999 09:22:23 GMT
From: pingouino@my-dejanews.com
Subject: Is there a shorter way?
Message-Id: <7fmpod$o7$1@nnrp1.dejanews.com>
Some friends of mine at work accidentally got into a little "challenge";
we implemented the same piece of code in different ways, then started
seeing who could do it in fewest characters. The task was to print out
an environment variable (in this case, USER) padded out to a minimum of
six characters with "x", or not modified if it was six characters or more.
So, "foo" becomes "fooxxx", "foos" becomes "foosxx", "foobar" remains
"foobar" and "foobars" remains "foobars" (note how the 7-letter word is
not truncated).
The best we came up with (with all unnnecessary spaces removed) was:
perl -e'$_=$ENV{USER};print$_."x"x(6-split//)'
Note how we are relying on USER being treated as a bareword and also
"split" defaulting to $_ and returning an array to be evaluated in
scalar context to mimic "length".
However, I can't help thinking "there must be a better way" - possibly with
a clever pattern match and substitution, or with a clever "pack". But we
can't find one. Can anyone else?
Therefore, I'm asking the collective wisdom of the Perl community to put me
out of my misery. Is there a shorter way?
Regards,
Ricky
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 03:28:59 -0500
From: "Planet CGI" <spmedia@earthlink.net>
Subject: Perl & CGI Sites Needed
Message-Id: <7fmmlp$hvm$1@fir.prod.itd.earthlink.net>
Perl & CGI Sites Needed
If you own or operate a Perl or CGI related web site, you may now receive
free banner advertising to increase traffic to your site by joining the
Planet CGI Banner Exchange.
This banner exchange is similar to other banner exchanges such as the Link
Exchange, but is reserved only for Perl or CGI related web sites.
To join, go to:
http://www.planetcgi.com/exchange
Thank You,
Planetv CGI
------------------------------
Date: 22 Apr 1999 06:16:41 GMT
From: hdiwan@diwanh.stu.rpi.edu ()
Subject: Re: Perl 'split' function in C??
Message-Id: <slrn7htfmn.jba.hdiwan@diwanh.stu.rpi.edu>
In article <37218884.5540010@news.skynet.be>, Bart Lateur wrote:
>Krusty276 wrote:
>
>>Does anyone have one, or know of a site that has the split funtion of Perl
>>converted to C? Sorry I'm just lazy, and wanna save sometime before I start
>>working on this?
It is possible to embed perl in C/C++. Perhaps someone more familiar with
the exact details can inform you better.
--
Hasan Diwan
------------------------------
Date: Sat, 17 Apr 1999 14:03:27 -0500
From: yossarian@mindspring.com (Yossarian)
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <yossarian-1704991403270001@user-2ivf4c6.dialup.mindspring.com>
In article <3714AC6C.967940A5@slpmbo.ed.ray.com>, Michael Genovese
<mikeg@slpmbo.ed.ray.com> wrote:
> I'm not saying PERL should be used for ALL scripts.
> But I do think that any script of any size and/or complexity is
> probably better off in PERL than in C-SHELL and/or AWK/NAWK.
Hear, hear. Especially if the task has anything to do with
text processing! The power of Perl's extended regexps is perhaps
one of the best arguments you can make in support of using Perl
over other langs.
--Yossarian
------------------------------
Date: Thu, 22 Apr 1999 04:28:28 -0400
From: Gary Gapinski <glg@apk.net>
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <371EDDAC.E31B7075@apk.net>
Hello, Mike:
Others have provided excellent reasons. I'll add just a few "guidelines"
and comments.
Michael Genovese wrote:
>
> Hello:
>
> I've been asked by my manager to come up with reasons, arguments,
> and/or guidelines for choosing one scripting language over another.
>
> Our group is a modest-sized TOOLS group in a large company.
> We have scripts in the following :
>
> * AWK (and NAWK)
> * C SHELL
> * KORN SHELL
> * PERL
> * TCL
>
> I'm a PERL fan.
> I know C SHELL a bit, but find PERL much easier to handle.
It is.
>
> My manager is definately a C SHELL fan, doesn't know PERL and doesn't
> really have the time to learn it. In point of fact, he's a C SHELL expert.
Will he be writing any scripts, or does he just wish to be able to
competently judge the output of others?
The old adage of "when the only tool one has is a hammer, everything
looks like a nail" comes to mind. In light of the proposed use of the C
shell, consider the variant "when the only tool one has is a
proctoscope...".
>
> He recently decided that we WILL do our scripts in C-SHELL & AWK/NAWK,
> but is now willing to modify his position if I can come up with
> compelling arguments to do otherwise.
A reasonable stance.
>
> Suggestions, people ?
<snip>
Some personal guidelines and retrospection...
I use Perl for any script
that exceeds ~24 lines
that uses arguments
that uses conditionals
that uses regular expressions
that includes exception handling
with an expected lifetime of >24 hours
whose expected maintainer might not be me
I use Bourne or Korn shell scripts for extremely simple tasks to be
performed by the superuser account.
I'm not familiar with tcl, but, as to the others, Perl provides all of
the functionality in a far easier to use fashion and with marked economy
of expression.
Perl also provides a pleasant scheme to modularize and thus easily
maintain logic common to the tools group as a whole.
Regards,
Gary
------------------------------
Date: Thu, 22 Apr 1999 08:35:42 GMT
From: agniora@usa.net
Subject: Perl2exe doesnt work on modules
Message-Id: <7fmn0u$uhg$1@nnrp1.dejanews.com>
when i try to make an exe using the perl2exe program. it makes one all right,
but i cant run it. it says such and such modules cannot be found. heres an
example program :
use Net::SMTP;
$smtp = Net::SMTP->new('spice.agni.com',
etrn => 'junk.agni.com',
timeout => 30,
debug => 3)
or die "cant connect";
$smtp->quit; # Close the SMTP connection
when i run perl2exe $0 it makes an exe but when i run that exe file it gives
the following error : use ./lib.pm; #perl2exe Can't locate Net/SMTP.pm in
@INC (@INC contains: g:/perl/lib/ PERL2EXE_STORAGE C :\TEMP lib\site
G:\agni\lib G:\agni\site\5.00502\lib G:\agni\site\lib .) at mail .pl line 3.
BEGIN failed--compilation aborted at mail.pl line 3.
This exe file was created with the evaluation version of Perl2Exe.
For more information visit http://www.demobuilder.com
(The full version does not display this message with a 2 second delay.)
...
anyone knows what can be done?
agniora
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 09:06:23 +0200
From: "Pieter Brouwer" <p.brouwer@prevalent.nl>
To: comp.lang.perl.misc
Subject: Please, HELP with uninitialized value error
Message-Id: <PRVL537BE7F4@prevalent.nl>
L.S.
I am trying to write a rather simple perl-script to scan files for certain
code-patterns. What I do seems very straightforward, but I get this error:
Use of uninitialized value at a.pls line 360, <DEFILE> line 154.
What happens in a.pls with respect to the mentioned filehandle is this:
open DEFILE, "$file" || do {
print OUTFILE "kan file $file niet openen; skipping\n";
return;
};
print OUTFILE "Scanning (1) file $file ...\n";
while ( $regel = <DEFILE> ) {
$regelnummer = $.;
&checkLine($regel,$file,$regelnummer);
}
close DEFILE;
The linenumber of the error (360) has absoluteley nothing to do with
<DEFILE>. It doesn't even have anything to do with the sub checkLine. It
always gives me the error on the first line (with the defined-statement) in
this sub:
# add_var
sub add_var {
my $varnaam = shift;
defined ($varlijst{$varnaam}) || ($varlijst{$varnaam} = 1);
}
no matter how I tossle the subs's around. So I don't think there is a
problem with ; or }-mismatches.
I must be overlooking something, but I have had enough staring at the code.
Can somebody tell me what I am doing wrong?
Thanks in advance
Pieter Brouwer
------------------------------
Date: Thu, 22 Apr 1999 09:43:57 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: Pieter Brouwer <p.brouwer@prevalent.nl>
Subject: Re: Please, HELP with uninitialized value error
Message-Id: <371EEF5D.30D113B9@no.spam.technologist.com>
Pieter Brouwer wrote:
> open DEFILE, "$file" || do {
> print OUTFILE "kan file $file niet openen; skipping\n";
> return;
> };
>
I would suggest the following instead:
unless (open DEFILE, "$file") {
print OUTFILE "kan file $file niet openen; skipping\n";
return;
}
I think you were trying to open a file named ($file or the value of the do
block) which I suspect is not what you intended.
As for the rest I am still not sure what you are trying to achieve.
HTH
Michael
------------------------------
Date: Thu, 22 Apr 1999 08:43:51 GMT
From: agniora@usa.net
Subject: Problem installing Date::Calc on linux
Message-Id: <7fmng7$ut1$1@nnrp1.dejanews.com>
installing the Date::Calc module on linux is getting difficult. the
instruction says to switch to the directory called Date-Calc-4.2 (created by
the tar file) and then perl Makefile.PL make make test make install
and during the first instruction "perl Makefile.PL" it says
WARNING: Setting VERSION via file 'Calc.pm' failed
at (eval 1) line 288
Writing Makefile for Date::Calc
and then when i try the next three lines it gives so many warnings and errors
i wont be able to list them all here. anyone knows what to do?
thanks
agniora
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 06:28:03 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Prombles storing multidimensional array in a file
Message-Id: <Arved_37-2204990628030001@dyip-95.chebucto.ns.ca>
In article <7flv9q$a39$1@nnrp1.dejanews.com>, telecafe@my-dejanews.com wrote:
> Now I would like to save a 2-D array as a file, to maintain the information
> during the program execution and quit. The 2-D array only consists of 0 and
> 1, but I don't want to use vec, pack and unpack functions because of saving
> execution time. I've tried DB_File and MLDBM modules to tie the array to
> the file, but I couldn't get a satisfactory result.
>
> What should I do to save 2-D array to a file, with the least effort?
>
One possibility is to use Storable. As an example:
#!perl -w
use Storable;
use Data::Dumper; # just for demo printout
$array2d = [ [1, 2, 3], [4, 5, 6], [7, 8, 9]];
store $array2d, 'array2d';
$array = retrieve('array2d');
print Dumper($array);
__END__
------------------------------
Date: Thu, 22 Apr 1999 16:26:30 +0900
From: "1h@g:@" <pitecus@tronage.com>
Subject: Q: I cannot install Sybperl 2.1 on Redhat 5.2.. Why?
Message-Id: <7fmipb$664$1@news.HanQ.net>
Hi!
I cannot install Sybperl 2.1 on Redhat 5.2....
It works well on caldera open linux...
------------------------------
Date: Thu, 22 Apr 1999 09:11:55 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: =?iso-8859-1?Q?=B1=E8=C0=E7=BA=C0?= <pitecus@tronage.com>
Subject: Re: Q: I cannot install Sybperl 2.1 on Redhat 5.2.. Why?
Message-Id: <371EE7DB.360B43B1@no.spam.technologist.com>
"1h@g:@" wrote:
> Hi!
>
> I cannot install Sybperl 2.1 on Redhat 5.2....
> It works well on caldera open linux...
I think you might be looking for the group
comp.psychic.to.answer.questions.with.no.description.of.the.problem.whatsoever
Michael ;-)
------------------------------
Date: Wed, 21 Apr 1999 23:14:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: remove space
Message-Id: <MPG.11885df9eae4f3f498990b@nntp.hpl.hp.com>
In article <yJyT2.5907$8m5.8839@newsr1.twcny.rr.com> on Thu, 22 Apr 1999
01:51:56 -0400, Dan Burke <dbws@----nospam----hotmail.com> says...
> How do you remove all spaces from a string?
>
> Example...
>
> Convert: $string = " remove all spaces ";
> To: $string = "removeallspaces";
$string =~ tr/ //d;
perldoc perlop and look for the tr operator.
No regex. No regex. No regex. No regex. No regex.
No s/ //g;
No.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 22 Apr 1999 06:34:37 GMT
From: Myke <myke98@my-dejanews.com>
Subject: Re: Script to tidy/format a C file
Message-Id: <7fmftu$nqb$1@nnrp1.dejanews.com>
In article <MPG.1188385b780f533e98990a@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> The command `man 1 cb` on my HP-UX system produces this:
>
> cb(1)
>
> NAME
> cb - C program beautifier, formatter
>
> I don't know how widely distributed this program is, but it's been
> around for decades. Long before Perl.
Thanks, I didn't know about 'cb' but having just gone through it, it doesn't
exactly do what I want/hoped for.
> > If it doesn't exist then I may take this opportunity to learn Perl and write
> > the script myself. But before I do so I wanted to ask if such a script
> > already existed, and also, can Perl handle such a task?
>
> Yes, of course it can. But why bother?
Well, I wanted to allow a little more flexibility such as having
user-definable formatting options. Examples would be whether or not opening
braces '{' would be on the same line as the control block, or whether they
started on a new line, and if on a new line, would they be indented or not.
What's the indent width? Should tabs be for indenting or padded spaces?
Should comment blocks be indented? Stuff like that.
--
m y k e
how ya gonna win when ya ain't right within?
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 22 Apr 1999 09:37:25 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: scriptlet to add line breaks at even multiples?
Message-Id: <371fed78.509489857@news.insnet.net>
On Tue, 20 Apr 1999 22:55:01 -0400, "David Clarke"
<clarked@hunterdon.csnet.net> enlightened us thusly:
>
>Counsel.Net wrote in message <371C263B.A747D8FA@counsel.net>...
>>Hi all,
>>
>>Is there a simple solution for adding linebreaks on long fields? I have
>>a field fed by a web form which I want to wrap at about 80 characters.
>
>You might also try write, and formatted output. I know that it is not a
>regexp, but it does split output at word boundaries.
Or look at Text::Wrap
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Thu, 22 Apr 1999 17:46:55 +0800
From: "Mohd Idaham" <idaham@mimos.my>
Subject: Sort function
Message-Id: <7fmqod$3s9$1@news5.jaring.my>
Hi,
How do I sort a list based on column? For example, format for a given array
is :
aaaa bbbb 1111
aaaa bbbb 1111...and so on..
If I used sort @arrayname, it will sort based on the first word (aaaa), so
how do I sort base on the third word?
Thank you in advance...
Idaham
------------------------------
Date: 22 Apr 1999 00:24:38 -0700
From: Michael Kelly - FVC PCD VET ~ <kelly@pcocd2.intel.com>
Subject: Re: Sorting Hashes of Arrays....
Message-Id: <us2ogkhm821.fsf@fht2006.fm.intel.com>
Anthony Baratta <Anthony@Baratta.com> writes:
>
> I rummaged through the examples in the FAQ and didn't understand them. I
> did figure out a way to do what I want - but would like to understand
> the examples given for sorting Hash on their values.
I did'nt understand the FAQ or examples either. It's actually
simpler than it seems. Best reading is Advanced Perl Programming from
ORA.com, first chapter.
First you have a bunch of arrays, and a hash of pointers.
Each key in the hash is a pointer to one of your arrays. So we need
to find the pointer to each array.
untested*
foreach $pointer (sort keys %HOA) {
print "pointer=$pointer array=@{$HOA{$pointer}}\n";
} # END of Foreach
You don't have to print the pointer, but I like to see things
labeled during debug. The important concept is to address an array as
@array, and a hash key as a pointer.
--
Not speaking for Intel
Michael Kelly (the one in Folsom)
1900 Prarie City Road desk (916) 356-2822
Folsom, CA. 95630 Page (916) 360-5847
M/S FM6-114 fax (916) 356-4561
"Just say no to a pretty GUI"
------------------------------
Date: 22 Apr 1999 09:22:19 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: weird difference between exec and system
Message-Id: <slrn7htrkt.so2.eric@plum.fruitcom.com>
Can anyone explain why the output is different depending on the call to
systrm or exec?
[info@plum 220500]$ cat 220499.db|perl -pe 'exec "sort -u"'|wc -l
3551
[info@plum 220500]$ cat 220499.db|sort -u|wc -l
3581
[info@plum 220499]$ cat 220499.db|perl -pe 'system "sort -u"'|wc -l
3581
--
Eric Smith
<eric@fruitcom.com>
Tel. 021 236 111
------------------------------
Date: Thu, 22 Apr 1999 15:30:44 +0800
From: "Austin Ming" <austin95002887@yahoo.com>
Subject: What is Perl module ?
Message-Id: <7fmj6e$372$1@justice.csc.cuhk.edu.hk>
What is Perl module ?
------------------------------
Date: Thu, 22 Apr 1999 09:20:59 +0000
From: Michael Cameron <Michael.Cameron@no.spam.technologist.com>
To: Austin Ming <austin95002887@yahoo.com>
Subject: Re: What is Perl module ?
Message-Id: <371EE9FB.D212B1EB@no.spam.technologist.com>
Austin Ming wrote:
> What is Perl module ?
Have a look at Perl FAQ 7
http://language.perl.com/newdocs/pod/perlfaq7.html#How_do_I_create_a_module_
Read the documentation you have (that came with perl) and the FAQs
before posting.
Michael
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5449
**************************************