[11815] in Perl-Users-Digest
Perl-Users Digest, Issue: 5415 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 19 03:12:14 1999
Date: Mon, 19 Apr 99 00:00:21 -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 Mon, 19 Apr 1999 Volume: 8 Number: 5415
Today's topics:
Re: A slight teaser....? <ronald_f@my-dejanews.com>
Re: A slight teaser....? <pogeybait@erols.com>
Re: A slight teaser....? (Larry Rosler)
Adding TCPIP # <wyzelli@yahoo.com>
advanced perl? <obinani@popd.ix.netcom.com>
Re: Books <uri@home.sysarch.com>
can't glob in Linux jbusco@my-dejanews.com
convert char into utf8 <palm@gfz-potsdam.de>
Re: how to make a directory publicly writable? <pogeybait@erols.com>
Re: how to make a directory publicly writable? (Sam Holden)
Re: ifeither--How about some feedback? (Larry Rosler)
Re: ifeither--How about some feedback? (Abigail)
Re: invoking by "fire and forget" (Abigail)
Re: invoking by "fire and forget" <e_broyles@yahoo.com>
iterating over hashes - how to get unique keys? <mudin@expert.cc.purdue.edu>
Re: Need example <uri@home.sysarch.com>
Re: Numeric String (Larry Rosler)
passing filehandles to functions <obinani@popd.ix.netcom.com>
Passing variables between scripts? How? cgi@higherlove.com
Re: Some troubles with format agniora@usa.net
Re: Splitting length instead of delimiting character? <ronald_f@my-dejanews.com>
Re: umask <ronald_f@my-dejanews.com>
Using Perl to collect NetWare performance info <dridenour@sciinfo.com>
where can I find Util/NumQueue.pm (Meling Mudin)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Apr 1999 05:57:46 GMT
From: Ronny <ronald_f@my-dejanews.com>
Subject: Re: A slight teaser....?
Message-Id: <7fegko$h3u$1@nnrp1.dejanews.com>
In article <zgsS2.1356$C76.597@c01read02.service.talkway.com>,
"stevenabell" <stevenabell@hotmail.com> wrote:
> 1. Treat a file, named file01 such that a variable can be assigned
> depending on the number of "/"s in its physical location. For example,
> if file01 had the location
>
> /usr/local/cgi-pub/depth1/file01
>
> then the variable would have a value of 5.
See
man perlfaq4
and look for "How can I count the number of occurrences of a substring
within a string?"
>
> 2. Treat thefile so that each word which occurs within
> it appears on a separate line, and write the results of this to a
> file named file01.sline
Read each line, use the function 'split' to split it into a list of words, and
the function 'join' to turn this list into a set of lines.
> 3. Once each words appears on a separate line, compare file01.sline
> with another file, named stoplist , so that each term which appears
> in stoplist is taken out from file01.sline , and write the results
> of this to file01.stop
Use a hash to store the words of stoplist. Read through file01 and see if the
words read are in the hash or not (use the exists function to do this)
> 4. Compare file01.stop so that if any of the words match with the
> words in another file, named check then file01.stop is copied and
> placed into a unique directory.
Sorry, I did not understand this one.
Drop me a mail if you need further assistance.
Ronald
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 02:28:50 -0400
From: "Pogeybait" <pogeybait@erols.com>
Subject: Re: A slight teaser....?
Message-Id: <7feias$bn4$1@autumn.news.rcn.net>
-----Original Message-----
From: stevenabell <stevenabell@hotmail.com>
Newsgroups: comp.lang.perl.misc
Date: Sunday, April 18, 1999 5:37 PM
Subject: A slight teaser....?
>Dear All,
>
>I'm having a few problems trying to get a small program to work.
>The program is split up into small parts, each performing a specific
>function. Here is what I am trying to do:
>
>1. Treat a file, named file01 such that a variable can be assigned
>depending on the number of "/"s in its physical location. For example,
>if file01 had the location
>
>/usr/local/cgi-pub/depth1/file01
>
>then the variable would have a value of 5.
To get a count of the "/"s, try
$cnt = $file =~ tr/\//\//;
>2. Treat thefile so that each word which occurs within
>it appears on a separate line, and write the results of this to a
>file named file01.sline
@words=split(/\//, $_);
Then do a "foreach" on @words and write each word to the file.
>3. Once each words appears on a separate line, compare file01.sline
>with another file, named stoplist , so that each term which appears
>in stoplist is taken out from file01.sline , and write the results
>of this to file01.stop
>
>For example, if the words "and", "of" and "the" were in stoplist
>and file01.sline contained:
>
>The
>cat
>and
>the
>dog
>sat
>on
>the
>mat
>
>Then file01.stop would be:
>
>The
>cat
>dog
>sat
>on
>mat
>
>4. Compare file01.stop so that if any of the words match with the
>words in another file, named check then file01.stop is copied and
>placed into a unique directory.
>
>Hope that someone will be able to help me out here. Absolutely any
>suggestions or pointers would be sincerely appreciated.
>
>Kindest regards,
>
>Steve Bell
>
>--
>Posted via Talkway - http://www.talkway.com
>Exchange ideas on practically anything (tm).
>
------------------------------
Date: Sun, 18 Apr 1999 23:44:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: A slight teaser....?
Message-Id: <MPG.1184709f599127f99898d5@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <zgsS2.1356$C76.597@c01read02.service.talkway.com> on Sun, 18
Apr 1999 21:37:35 GMT, stevenabell <stevenabell@hotmail.com> says...
...
> 1. Treat a file, named file01 such that a variable can be assigned
> depending on the number of "/"s in its physical location. For example,
> if file01 had the location
>
> /usr/local/cgi-pub/depth1/file01
>
> then the variable would have a value of 5.
perlfaq4: "How can I count the number of occurrences of a substring
within a string?"
> 2. Treat thefile so that each word which occurs within
> it appears on a separate line, and write the results of this to a
> file named file01.sline
>
> I presume that I must use the sort command in some way?
Why -- where is sorting involved in the problem statement?
print OUTFILE join "\n", /(\w+)/g, "" while <INFILE>;
Now, if you intend to write each word once only, no matter how many
times it appears in the file, look in perlfaq4": "How can I extract
just the unique elements of an array?"
> 3. Once each words appears on a separate line, compare file01.sline
> with another file, named stoplist , so that each term which appears
> in stoplist is taken out from file01.sline , and write the results
> of this to file01.stop
...
perlfaq4: "How can I tell whether a list or array contains a certain
element?"
> 4. Compare file01.stop so that if any of the words match with the
> words in another file, named check then file01.stop is copied and
> placed into a unique directory.
perlfaq4: "How can I tell whether a list or array contains a certain
element?"
I'll leave the file copying to you.
> Hope that someone will be able to help me out here. Absolutely any
> suggestions or pointers would be sincerely appreciated.
Read the FAQs. The FAQs are your friend.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Apr 1999 14:21:27 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Adding TCPIP #
Message-Id: <jDyS2.5$vv2.3078@vic.nntp.telstra.net>
I have a short Perl script which parses a file and extracts information
which is incremented to three arrays by key $user.
The items extracted are all numeric (time, Octets in, Octets out). This is
the segment of the code which extracts the data I need. The script reads a
paragraph at a time as per the sample below.
if (/User-Name = "([^"]+)"/) {
$user = $1;
if (/Acct-Session-Time = (\d+)/) {
$elapsed = $1;
/Acct-Input-Octets = (\d+)/;
$input = $1;
/Acct-Output-Octets = (\d+)/;
$output = $1;
$used{$user} += $elapsed;
$input{$user} += $input;
$output{$user} += $output;
}
}
Can anyone tell me what regexp I should use to extract the IP number from
the appropriate field (Framed-IP-Address)? I cannot find any reference to
IP address in the regexp FAQ (perlfaq6) and am still very much a newbie at
this.
I want to use essentially the same information as in the program above only
output it to a log file by session rather that the cumulative totals I am
achieving above.
A sample of the file to be parsed is below.
Wed Mar 31 18:10:17 1999
Acct-Session-Id = "0F00007B"
User-Name = "user"
NAS-IP-Address = 203.39.3.130
NAS-Port = 5
NAS-Port-Type = Async
Acct-Status-Type = Stop
Acct-Session-Time = 12
Acct-Authentic = RADIUS
Connect-Info = "48000 MNP/NONE"
Acct-Input-Octets = 2329
Acct-Output-Octets = 8
Called-Station-Id = "89461300"
Acct-Terminate-Cause = User-Request
Vendor-Specific = ""
Service-Type = Framed-User
Framed-Protocol = PPP
Framed-IP-Address = 203.39.3.170
Acct-Delay-Time = 0
Timestamp = 922869617
Request-Authenticator = Unverified
Also is anyone interested in giving me some rates for Perl/CGI programming?
TIA
Wyzelli
reply to NG is fine or e-mail
------------------------------
Date: Mon, 19 Apr 1999 02:41:14 -0400
From: "Dunn One" <obinani@popd.ix.netcom.com>
Subject: advanced perl?
Message-Id: <7fej5p$bo@sjx-ixn1.ix.netcom.com>
Does anybody have any suggestions for learning advanced perl? If so, please
helpth
------------------------------
Date: 19 Apr 1999 00:50:08 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Books
Message-Id: <x7hfqdkydb.fsf@home.sysarch.com>
>>>>> "KR" == Ken Robbins <puyrebel@prodigy.net> writes:
KR> Also, a really good place to buy books at a cheap price (recommended by
KR> Randal) is buy.com. Their prices are about the same as bookpool.com's.
i just did a search for perl books on both places. bookpool is a buck or
2 cheaper for most the the books i compared and a buck or 2 more
expensive for a couple. bookpool has a fixed shipping charge of $3 for
the first book and $1 for each additional one (similar to amazon and
B&N). buybook doesn't seem to have a fixed price for shipping. their faq
says they calculate based on weight (since when are books indexed by
weight?) and averages $4-8 (per shipment? per book?). i have one failing
with bookpool, they charge MA sales tax of 5% which i pay since i get
shipped in MA where i live. i don't think buybook will charge me sales
tax as the other biggies don't either.
but i like bookpool and will support them since they are computer books
only. they seem to have a better selection sometimes than the
biggies. amazon doesn't need my purchases to keep them in the red! :-)
i may check out buy* for other things like cd's if their prices are
comparably discounted.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Mon, 19 Apr 1999 04:52:10 GMT
From: jbusco@my-dejanews.com
Subject: can't glob in Linux
Message-Id: <7fecpo$e79$1@nnrp1.dejanews.com>
Hi,
I'm a newbie to perl and linux, but enthusiastically learning.
I'm going through the Llama book "Learning Perl". There is a
really simple exercise to change to a directory and list the
files in that directory through globbing. It doesn't work on
my RedHat 5.0 system!
Here's the script:
#!/usr/bin/perl -w
print "Where to? ";
chomp($newdir = <STDIN>);
chdir($newdir) || die "Cannot chdir to $newdir: $!";
foreach (<*>) {
print "$_\n";
}
And here's the output:
$ perl -w answer.pl
Where to? /bin
shell-init: could not get current directory: getwd: cannot access parent
directories
[followed by a listing of all the files in my HOME directory, not /bin!]
Can anyone explain to me why this simple code doesn't work? Does it have
anything to do with perl relying on csh, but Linux's csh is really a link
to tcsh?
Thanks,
John
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 08:54:53 +0200
From: "Hartmut P." <palm@gfz-potsdam.de>
Subject: convert char into utf8
Message-Id: <7fejuq$i33$1@dmz1.gfz-potsdam.de>
Is there a function/methode/module that convert chars into utf8 (also works
on windos) ?
thanx for any help
------------------------------
Date: Mon, 19 Apr 1999 01:59:49 -0400
From: "Pogeybait" <pogeybait@erols.com>
Subject: Re: how to make a directory publicly writable?
Message-Id: <7fegkg$26a$1@autumn.news.rcn.net>
Nick Lee wrote in message
>Hi,
>
>I think the title explains the purpose of this post. Some of my cgi
>scripts create new directory and would write some new files to that
>newly created directory. But the cgi script can't write to the new dir
>unless it's publicly writable
>I've tried the following:
>
>umask 0;
>mkdir dir, 777;
>
>the permission of the new dir still isn't "rwxrwxrwx" even if I set
>the umask to 0 beforehand.
Another suggestion. Let UNIX handle this by calling chmod on the new
directory.
mkdir dir;
system ("chmod dir 777");
...
pog
pogeybait@erols.com
------------------------------
Date: 19 Apr 1999 06:02:07 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: how to make a directory publicly writable?
Message-Id: <slrn7hlhmv.4qi.sholden@pgrad.cs.usyd.edu.au>
On Mon, 19 Apr 1999 01:59:49 -0400, Pogeybait <pogeybait@erols.com> wrote:
>
>Nick Lee wrote in message
>>Hi,
>>
>>I think the title explains the purpose of this post. Some of my cgi
>>scripts create new directory and would write some new files to that
>>newly created directory. But the cgi script can't write to the new dir
>>unless it's publicly writable
>>I've tried the following:
>>
>>umask 0;
>>mkdir dir, 777;
>>
>>the permission of the new dir still isn't "rwxrwxrwx" even if I set
>>the umask to 0 beforehand.
>
>
>Another suggestion. Let UNIX handle this by calling chmod on the new
>directory.
>
>mkdir dir;
>system ("chmod dir 777");
>...
What's wrong with the perl chmod() functions...
Your arguments are in the wrong order so it won't work anyway.
The correct solution has been posted already - use octal when you mean octal...
0777 != 777
--
Sam
The very fact that it's possible to write messy programs in Perl is also
what makes it possible to write programs that are cleaner in Perl than
they could ever be in a language that attempts to enforce cleanliness.
--Larry Wall
------------------------------
Date: Sun, 18 Apr 1999 22:42:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ifeither--How about some feedback?
Message-Id: <MPG.11846232ec05c1349898d3@nntp.hpl.hp.com>
In article <eDxS2.1279$hl6.54301@news.itd.umich.edu> on Mon, 19 Apr 1999
03:43:06 GMT, Sean McAfee <mcafee@waits.facilities.med.umich.edu>
says...
...
> That reminds me...Does anyone know if allowing multiple statement modifiers
> into Perl has ever been considered? I sometimes find myself wanting to do
> something like:
>
> print "$_ is even\n" if $_ % 2 == 0 foreach 0..10;
>
> It doesn't seem like it would be significantly more difficult to parse than
> the single-modifier case, but I'm just guessing.
You can simply turn it around (use an ordinary conditional instead of a
second statement modifier):
$_ % 2 == 0 and print "$_ is even\n" foreach 0..10;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 19 Apr 1999 06:09:41 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: ifeither--How about some feedback?
Message-Id: <7fehb5$4pa$1@client2.news.psi.net>
Sean McAfee (mcafee@waits.facilities.med.umich.edu) wrote on MMLVII
September MCMXCIII in <URL:news:eDxS2.1279$hl6.54301@news.itd.umich.edu>:
%% In article <7fbgj8$m4f$1@client2.news.psi.net>,
%% Abigail <abigail@fnx.com> wrote:
%%
%% True. What I meant was that currently there's no "last EXPR" semantics,
%% like "last foo();".
That's because there's already a 'last LABEL;'. The only thing that would
make sense for 'last EXPR' is an EXPR whose result is a LABEL.
%% >LOOP:
%% > while (1) {
%% > # do some stuff.
%% > foreach ($a, $b, $c, $d, $e, $f) {last LOOP if $_ < 0}
%% > }
%%
%% Neat. I think the deep-seated revulsion for "goto" statements--and, by
%% extension, labels--that I acquired when I learned C has made it difficult
%% for me to even consider using labels in other languages, even when it's
%% eminently appropriate, as it is here.
%%
%% That reminds me...Does anyone know if allowing multiple statement modifiers
%% into Perl has ever been considered? I sometimes find myself wanting to do
%% something like:
%%
%% print "$_ is even\n" if $_ % 2 == 0 foreach 0..10;
%%
%% It doesn't seem like it would be significantly more difficult to parse than
%% the single-modifier case, but I'm just guessing.
do {print "$_ is even\n" if $_ % 2 == 0} foreach 0 .. 10;
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: 19 Apr 1999 04:17:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: invoking by "fire and forget"
Message-Id: <7feao6$3uo$1@client2.news.psi.net>
e_broyles (e_broyles@yahoo.com) wrote on MMLVII September MCMXCIII in
<URL:news:7fe0mo$4am$1@nnrp1.dejanews.com>:
__ I am not sure that I understand how this could help. I guess that it would
__ make sure it ran the larger program first, before the cgi output.
What "larger" program? All you wanted was a program that wouldn't stop.
I gave you one.
__ How does
__ this start my program separate from the main so that it will continue to
__ process?
If you want to fork off another process, use fork().
Abigail
--
perl -wlne '}print$.;{' file # Count the number of lines.
------------------------------
Date: Mon, 19 Apr 1999 06:25:01 GMT
From: e_broyles <e_broyles@yahoo.com>
Subject: Re: invoking by "fire and forget"
Message-Id: <7fei7m$ids$1@nnrp1.dejanews.com>
Yes, I see that I phrased that incorrectly. I want to split off another
process that will continue even if the parent process fails. I am pretty sure
that fork() is not available in the NT version.
In article <7feao6$3uo$1@client2.news.psi.net>,
abigail@fnx.com wrote:
> e_broyles (e_broyles@yahoo.com) wrote on MMLVII September MCMXCIII in
> <URL:news:7fe0mo$4am$1@nnrp1.dejanews.com>:
> __ I am not sure that I understand how this could help. I guess that it would
> __ make sure it ran the larger program first, before the cgi output.
>
> What "larger" program? All you wanted was a program that wouldn't stop.
> I gave you one.
>
> __ How does
> __ this start my program separate from the main so that it will continue to
> __ process?
>
> If you want to fork off another process, use fork().
>
> Abigail
> --
> perl -wlne '}print$.;{' file # Count the number of lines.
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 01:26:02 -0500
From: "mel@purdue.edu" <mudin@expert.cc.purdue.edu>
Subject: iterating over hashes - how to get unique keys?
Message-Id: <Pine.GSO.3.96.990419011950.28754A-100000@expert.cc.purdue.edu>
Hi,
I am a newbie (two weeks experience). Here's a snippet of code that I am
currently working on:
-----
use MD5;
my $md5 = new MD5;
my $file = "";
my $d = 0;
my $thishash = 0;
my $p = 0;
my $index = 0;
my $dname = $ARGV[0] || die "Usage: $0 dir name";
opendir (ARGV, $dname) || die $!;
my @filelist = readdir (ARGV);
closedir(ARGV);
# loop through each file in the file list and
# compute their checksums
# the computed checksum is then saved in a hash to be compared
# with the file that contains previously computed
# checksum
foreach $file (@filelist) {
open (F, $ARGV[0]."/".$file) || die $!;
$index++;
seek (F, 0, 0);
$md5->reset;
$md5->add(<F>);
$d = $md5->hexdigest;
# now, i want to store the value of the checksum, i.e $d
# that is computed into a hash, so that i can use it later,
# but my subsequent attempts only store the value of the
# checksum of the last file on the list only.
# Question: how can i do this? and how do i make sure that
# each checksum is stored into the hash so that i can reference
# them later (in anohter subroutine) because i need to
# compare the computed checksum against a data file?
}
------
Thanks for any help.
-mel
------------------------------
Date: 19 Apr 1999 01:01:35 -0400
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Need example
Message-Id: <x7emlhkxu8.fsf@home.sysarch.com>
>>>>> "J" == Jim <jim@newglobal.net> writes:
J> Well, let's see...Forms > cgi > perl.
J> Interesting how that works!
so you know that all cgi is done in perl! well done, you have proved you
know nothing about cgi nor about perl. most perl is NOT used for
cgi. maybe most cgi is done in perl but that is irrelevent since you
never mentioned perl in your original post. you never mentioned a
particular perl problem. you just mention passing stuff from form to
form. that is the cgi domain and should be asked in the cgi groups. it
could be done in any language.
J> Do you need any more help understanding my question, Mr. Perl
J> Programming man?
yes we do, mr. hand me it to me on platter man.
J> Or do you have nothing else better to do than start some stupid
J> flame war on what I thought would be a helpful newgroup?
he didn't start a flame war, and neither did you. most everyone else in
this group will ignore you for you fine and eloquent comments and polite
way of requesting help. no more responses, no flame war, very simple.
J> In the mean time, KMA!
sorry, we are unable to comply with your request since your rectum is
being occupied by your cranium.
try again, good luck next time!
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sun, 18 Apr 1999 23:18:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Numeric String
Message-Id: <MPG.11846a9c9175d0cc9898d4@nntp.hpl.hp.com>
In article <7fdr32$2c3$1@client2.news.psi.net> on 18 Apr 1999 23:49:54
GMT, Abigail <abigail@fnx.com> says...
> Tom Christiansen (tchrist@mox.perl.com) wrote on MMLVI September MCMXCIII
> in <URL:news:371a2719@cs.colorado.edu>:
> ## Frank de Bot <debot@xs4all.nl> writes:
> ## :How can I detect whether a string is numeric or not. I know it's some
> ## :where in the faq's but I couldn't find it anymore.
> ##
> ## YOU CAN'T FIND THE FAQS?
>
> That's not what he said.
So let's be kind and aim him at the end of perlfaq4 (in the section
Data:Misc, not in the first section, Data:Numbers): "How do I determine
whether a scalar is a number/whole/integer/float?"
`perldoc -q numeric` doesn't locate it, and `perldoc -q number` locates
it and a whole lot more.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 19 Apr 1999 02:42:27 -0400
From: "Dunn One" <obinani@popd.ix.netcom.com>
Subject: passing filehandles to functions
Message-Id: <7fej82$e6@sjx-ixn1.ix.netcom.com>
I know how to do this for reading, but how do you do this for writing? Any
suggestions would be appreciated. Thanks
------------------------------
Date: Mon, 19 Apr 1999 06:32:29 GMT
From: cgi@higherlove.com
Subject: Passing variables between scripts? How?
Message-Id: <371acd26.32630708@news.phnx.uswest.net>
I have some scripts set-up allowing people to search a database and
then contact others if they need to whom they find through the
database. What I was wondering...is there anyway that I can keep a
user's login name variable constant with them in the system, so they
don't have to keep entering their basic "name, email, etc."
information everytime they contact another database user? How can I
send a session/user idenitifier with them through all their system
usage?
Thanks!
Lisa
------------------------------
Date: Mon, 19 Apr 1999 04:52:07 GMT
From: agniora@usa.net
Subject: Re: Some troubles with format
Message-Id: <7fecpl$e78$1@nnrp1.dejanews.com>
In article <371904E3.F8122EB4@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
> agniora@usa.net wrote:
> >
> > the following script is giving the error
> > format not terminated at myprog.pl line 13
> >
> > heres my program :
> > sub write_line {
> > local ($astring, $anumber) = @_;
> > $~ = "ALINE";
> > write;
> > }
> > write_line "hello", 24.793;
> > format ALINE =
> > @<<<<<<<<<<<< @#####.##
> > $astring, $anumber
> > .
> >
> > anyone knows whats going on here?
>
> Well, I can make a guess. I'll guess that your format is not
> terminated at line 19. That's what the error says. And I'll
> guess you didn't go to the perldiag manpage and look up what that
> error means:
>
> Format not terminated
> (F) A format must be terminated by a line with a
> solitary dot. Perl got to the end of your file without
> finding such a line.
>
> So, odds are that there's some whitespace following your period on
> line 19, and it's messing things up. Delete the whitespace after the
> period.
>
> HTH,
> David
Ive checked for white spaces and without anything after the full stop its
giving the same error msg. however one noticeable thing is that the error msg
is reported twice.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 06:28:44 GMT
From: Ronny <ronald_f@my-dejanews.com>
To: mats.pettersson@falukuriren.se
Subject: Re: Splitting length instead of delimiting character?
Message-Id: <7feiel$ihp$1@nnrp1.dejanews.com>
This message mailed and posted
In article <3718C410.1DB6F062@falukuriren.se>,
Mats Pettersson <mats.pettersson@falukuriren.se> wrote:
> I'm currently writing a script that would split up lines in a file into
> fields for import into a database.
>
> However most examples i see uses the split /x/ method, where in my case
> i would need to split a line in different sizes into an array.
>
> A line in the file may look as follows:
>
> 1999-01 6 4 2 1 7 5 3
>
> So the first field should be 7 characters the second 4 characters the
> third 4 characters and so on. Some of the fields might be empty (like
> the 7th in this example) so thats wy i just can't split with whitespace.
There is no builtin function that does what you want (at least none that I
know), but it is easy to write one yourself.
Three easy approaches come to my mind:
(1) You could do a
split /\s+/
and then use sprintf to format the items, or
(2) you could define an array of the field lengths desired, and then use
repeated substr calls to extract the fields, or
(3) you could use a regexp such as
/(.{7})(.{4})(.{4}).../
and extract the fields as $1, $2, $3 etc.
Hope that helps.
Ronald
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 06:20:06 GMT
From: Ronny <ronald_f@my-dejanews.com>
To: martin@guest-books.com
Subject: Re: umask
Message-Id: <7fehug$i2q$1@nnrp1.dejanews.com>
(This message mailed and posted)
In article <7fb3up$sie$1@newnews.global.net.uk>,
"Martin" <martin@guest-books.com> wrote:
> Will umask(00) at the top of my script cause new files made to have
> default properties of 0777?
No, it would set them to 0666. There is no way to automatically set the x-bit
under Unix.
You said you are running the program under NT. I do not know to what extend NT
honours umask at all.
Ronald
--
Ronald Fischer <ronald_f@my-dejanews.com>
http://ourworld.compuserve.com/homepages/ronald_fischer/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 19 Apr 1999 00:04:59 -0400
From: "David Ridenour" <dridenour@sciinfo.com>
Subject: Using Perl to collect NetWare performance info
Message-Id: <7fea4f$f3j$1@autumn.news.rcn.net>
I am looking for Perl scripts to access performance data from NetWare
4.11servers such as utilization and dirty cache buffers. Any suggestions on
how to do this would be appreciated.
Thanks,
David Ridenour
------------------------------
Date: 19 Apr 1999 06:34:17 GMT
From: mudin@expert.cc.purdue.edu (Meling Mudin)
Subject: where can I find Util/NumQueue.pm
Message-Id: <7feip9$8mj$1@mozo.cc.purdue.edu>
Hi,
I have been probing for Util/NumQueue.pm on my systems (three SunOS boxes)
and the entire CPAN site. Anyone aware of the existence of Util/NumQueue.pm?
-mel
------------------------------
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 5415
**************************************