[18424] in Perl-Users-Digest
Perl-Users Digest, Issue: 592 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 29 21:09:02 2001
Date: Thu, 29 Mar 2001 18:05:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985917911-v10-i592@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 29 Mar 2001 Volume: 10 Number: 592
Today's topics:
Re: $title and ($title) as lvalue (Eric Bohlman)
Re: $title and ($title) as lvalue <uri@sysarch.com>
Re: add lines from logfile <comdog@panix.com>
Re: Adding Values from an Array <ves@ves.net>
Re: Adding Values from an Array (Eric Bohlman)
bash history from perl? (Peter Bismuti)
Re: Better way to Flushing STDOUT? <bernie@fantasyfarm.com>
Re: cannot fork? <mischief@velma.motion.net>
Re: fetch back STDERR outputs <rick.delaney@home.com>
Re: Funny behavior? <gtoomey@usa.net>
Re: Funny behavior? (Adam Moore)
Re: Funny behavior? <mischief@velma.motion.net>
getc a single key-press without hitting <return>? <bjoseph@ti.com>
Re: getc a single key-press without hitting <return>? (Jay Tilton)
NT file permissions (Gary Perkins)
Re: Perl newbie <leongyc@tp.edu.sg>
Re: perl script to browse web site <gtoomey@usa.net>
Re: Provo Perl Mongers Meeting <comdog@panix.com>
Re: regexp with multiple \n? <mischief@velma.motion.net>
Re: splitting <no@spam.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Mar 2001 23:24:06 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: $title and ($title) as lvalue
Message-Id: <9a0g6m$1pe$1@bob.news.rcn.net>
Mahesh A <maheshasolkar@yahoo.com> wrote:
> Hi,
> Can anyone elaborate on the difference between...
> open (NOTE, $notesFile) || die "Cannot open $notesFile to read\n";
> my $title = <NOTE>;
<NOTE> is in scalar context here, so it evaluates to a scalar containing a
single line.
> and
> open (NOTE, $notesFile) || die "Cannot open $notesFile to read\n";
> my ($title) = <NOTE>;
> The second assignment ate up the whole NOTE handler, as if the
> INPUT_RECORD_SEPARATOR was undef'd. But only the first line came into
> $title.
In the second case, the parens force the assignment into list context, so
<NOTE> evaluates to list consisting of all the lines from the file. Since
there's only one scalar variable in the list on the left-hand-side of the
assignment, only the first element of the list gets assigned.
------------------------------
Date: Thu, 29 Mar 2001 23:29:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: $title and ($title) as lvalue
Message-Id: <x7bsqkxig3.fsf@home.sysarch.com>
>>>>> "MA" == Mahesh A <maheshasolkar@yahoo.com> writes:
MA> open (NOTE, $notesFile) || die "Cannot open $notesFile to read\n";
you should put $! in the die message.
MA> my $title = <NOTE>;
that is a scalar context so you read one line.
MA> my ($title) = <NOTE>;
that is a list context so it reads all the lines, assigns the first one
to $title and throws the rest away.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 29 Mar 2001 18:01:27 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: add lines from logfile
Message-Id: <comdog-CAFB8C.18012729032001@news.panix.com>
In article <3AC34034.DB1D4AD2@chemsoft.de>, Tobias Dresbach
<td@chemsoft.de> wrote:
> Hi all,
> i have a log file like the following:
> IP-Address Port kbytes
> 192.168.0.1 53 10
> 192.168.1.2 21 150
> how is it possible to add all kbytes from the same port and ip-address?
heh - this looks like an example from the Stonehenge Learning Perl
class materials. i've taught it many times saying "suppose
you wanted to do this". now someone has. cool :)
--
brian d foy <comdog@panix.com>
------------------------------
Date: Thu, 29 Mar 2001 15:26:47 -0800
From: Vespasian <ves@ves.net>
Subject: Re: Adding Values from an Array
Message-Id: <WsTDOnBivUtlNT=iS8RGeWFo9OHS@4ax.com>
On Thu, 29 Mar 2001 22:30:26 GMT, FORM Rookie <m0rejunkmail@home.com>
wrote:
>OK here we go again. I need your help.
>
>Here's what I have:
>
>%some_things = ($thing1 => "2",
> $thing2 => "4");
>
$don't use a scalar here. Use:
%some_things = (thing1 => "2",
thing2 => "4");
that should do it.
ves
>foreach $object (keys %some_things) {
>
> print "$object is roughly $some_things{$object}";
>
>}
>
>------------------------------------------------------
>
>Here's where I hit the infamous "brick wall".
>
>I need to add the values of $thing1 (2) and $thing2 (4) for a Grand
>Total.
>
>$total = ((value of $thing1) + (value of $thing1));
>
>I tried different approaches and hit a brick wall. Any help is
>appreciated.
>
>~FORM Rookie
------------------------------
Date: 29 Mar 2001 23:34:50 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Adding Values from an Array
Message-Id: <9a0gqq$nbr$1@bob.news.rcn.net>
In comp.lang.perl.misc FORM Rookie <m0rejunkmail@home.com> wrote:
> OK here we go again. I need your help.
> Here's what I have:
> %some_things = ($thing1 => "2",
> $thing2 => "4");
> foreach $object (keys %some_things) {
> print "$object is roughly $some_things{$object}";
^^^^^^^
One time my father and I were watching a high school football game and the
announcer, who apparently suffered from a rare condition that would
cause him to stop breathing if his lips stopped moving, said that one of
the teams "would be penalized approximately five yards." My father, being
a bit of a stickler about language, said "No. *Exactly* five yards."
(Yes, I know about finite measurement precision, but that spoils all the
fun.)
I wasn't aware that Perl supported non-deterministic hashes (and yes, I
know you could implement one with tie.)
> }
> ------------------------------------------------------
> Here's where I hit the infamous "brick wall".
> I need to add the values of $thing1 (2) and $thing2 (4) for a Grand
> Total.
> $total = ((value of $thing1) + (value of $thing1));
> I tried different approaches and hit a brick wall. Any help is
> appreciated.
You already know how to get the value of a hash element, using a variable
as the key; just use $thing1 and $thing2 the same way you used $object to
get the two values, and add them just like you'd add anything else.
------------------------------
Date: 30 Mar 2001 00:58:43 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: bash history from perl?
Message-Id: <9a0lo3$qto$1@news.fsu.edu>
I tried writing a script that executed the 'history' command and
parsed the output. What I discovered is that the history command is
a bash command, there is no binary file, no /bin/history or
/usr/bin/history. I can't figure out any way of executing it from within
perl, `` don't work. Reading in the .bash_history command directly
doesn't work either since the history is cached and what is in the file
does not represent the current history, but what the history was the
last time a shell exited ( I believe ).
How can this be done?
Thanks!
------------------------------
Date: Thu, 29 Mar 2001 20:04:45 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Better way to Flushing STDOUT?
Message-Id: <9mm7ct4hvcho9b4tfu756pc5etapm2c025@news.supernews.net>
Ilmari Karonen <iltzu@sci.invalid> wrote:
} In article <3AC0F6FC.48D60A15@interbulletin.com>, Hon-Chi Ng wrote:
} >
} >I would like to flush any buffered output in STDOUT at a given point in my
} >Perl script, is
} >
} > $old_autoflush = $|; $| = 1; print ""; $| = $old_autoflush;
}
} {local $| = 1}
Doesn't quite work: you need the print to actually make the flush happen:
{local $| = 1; print ""}
does the job.
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Fri, 30 Mar 2001 00:48:07 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: cannot fork?
Message-Id: <tc7lu714o6modf@corp.supernews.com>
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Gwyn" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:
> Gwyn> $pid = fork;
> Gwyn> unless defined $pid die "Cannot fork: $!";
> Except you'd probably want to use legal Perl syntax there as well. :)
> $pid = fork;
> defined $pid or die "cannot fork: $!";
> I can't quite figure out just where you were going with yours... :)
I think Gwyn was heading this direction:
$pid = fork;
unless (defined $pid) { die "cannot fork: $!" }
The fuller explanation of why the error was spurious, as Gwyn
mentioned, is that the child had already forked, found that
$pid was false (as it should be in the child), and gave the
reason for the last error when it saw q{$!}, which doesn't
make sense for the fork() because the fork, having succeeded,
didn't set errno.
q{perldoc -f fork} would help elucidate why this is so.
Chris
--
Christopher E. Stith
People understand instinctively that the best way for computer programs to
communicate with each other is for each of the them to be strict in what they
emit, and liberal in what they accept. The odd thing is that people themselves
are not willing to be strict in how they speak, and liberal in how they listen.
-- Larry Wall, 2nd State of the Onion Address, August 1998
------------------------------
Date: Fri, 30 Mar 2001 00:11:45 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: fetch back STDERR outputs
Message-Id: <3AC3D282.71A123EE@home.com>
Mark Jason Dominus wrote:
>
> In article <3AC34836.BB261E6@home.com>,
> Rick Delaney <rick.delaney@home.com> wrote:
> >The purpose of 'use vars' is to prevent 'use strict' from complaining
> >about unqualified package variables. In this sense, it is obsolete
> >because 'our' can now fill that role.
>
> That's not exactly true. 'use vars' has also been advertised as a way
> to avoid 'only once' warnings.
Okay, I stand corrected.
> >So there is nothing for
> >
> > our(*TOUCH)
> >
> >to do.
>
> I find it amazing that you could say this in response to an article of
> John's which shows quite clearly that there *is* something for
> our(*touch) to do.
I don't see what's so amazing given the premise I started with.
> >If you only want to suppress the "used once"
> >warning then I'd suggest 'use warnings'.
>
> 'use warnings' does not work properly in 5.6.0 with regard to 'only
> once' warnings.
That's a pretty sweeping generalization.
$ perl -Mwarnings -e 'no warnings "once";print $x'
Use of uninitialized value in print at -e line 1.
$
But if
{
no warnings "once";
open TOUCH,"+>zero-length.file" or die $!;
}
is a little wordy, one can still do
{
our $TOUCH;
open TOUCH,"+>zero-length.file" or die $!;
}
since "only once" warnings apply only to the symbol name. But I think
the intention of the first is clearer.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Fri, 30 Mar 2001 10:45:07 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Funny behavior?
Message-Id: <JtQw6.5704$45.32828@newsfeeds.bigpond.com>
"Bryan Coon" <bcoon@sequenom.com> wrote in message
news:3AC3B138.A0DA485D@sequenom.com...
> If I do this:
>
> my $test = <<END
> Some garbage in here, blah, blah
> END
>
> No problem. However if I do this:
> sub foo {
> my $test = <<END
> Some garbage in here, blah, blah
> END
> }
>
> It fails. The indention of the END tweaks things. Not a big deal, but
> it sure looks funny style-wise when it is buried in a sub, a for loop,
> and maybe an if statement.
>
> Does the end have to be without preceding spaces?
YES
> Is this normal, or am
> I using this wrong?
I'm normal, but I'm not sure about you.
>By the way *ahem* what is that called? The
> <<END...END stuff?
A "here document". See http://www.perldoc.com/perl5.6/pod/perlfaq4.html
> Thanks!
>
>
Your welcome.
gtoomey
------------------------------
Date: 30 Mar 2001 00:51:26 GMT
From: adam@foo.sweet.as (Adam Moore)
Subject: Re: Funny behavior?
Message-Id: <slrn9c7m8g.t8f.adam@foo.sweet.as>
>> No problem. However if I do this:
>> sub foo {
>> my $test = <<END
>> Some garbage in here, blah, blah
>> END
>> }
>>
>> Does the end have to be without preceding spaces?
>YES
Here documents can be difficult to debug and read at times, you might like to
use something like the following instead:
my $test = q{
some garbage
};
Won't mess with your indentation, and you can zoom around your blocks with ]}
in vim. :)
-- adm
------------------------------
Date: Fri, 30 Mar 2001 01:51:16 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Funny behavior?
Message-Id: <tc7pkks2o5725a@corp.supernews.com>
Bryan Coon <bcoon@sequenom.com> wrote:
> If I do this:
> my $test = <<END
> Some garbage in here, blah, blah
> END
> No problem. However if I do this:
> sub foo {
> my $test = <<END
> Some garbage in here, blah, blah
> END
> }
#!/usr/bin/perl -w
use strict;
sub foo {
my $test = <<" END";
Some garbage in here, blah, blah
END
print $test;
}
foo();
__END__
gives " Some garbage in here, blah, blah\n" when it prints
q{$test}.
> It fails. The indention of the END tweaks things. Not a big deal, but
> it sure looks funny style-wise when it is buried in a sub, a for loop,
> and maybe an if statement.
> Does the end have to be without preceding spaces? Is this normal, or am
> I using this wrong? By the way *ahem* what is that called? The
> <<END...END stuff?
perldoc -q HERE
You are supposed to check the FAQ before posting.
Chris
--
Christopher E. Stith
If they can get you asking the wrong questions, they don't
have to worry about the answers.
-- Thomas Pynchon, Gravity's Rainbow
------------------------------
Date: Thu, 29 Mar 2001 17:03:49 -0800
From: Brian Joseph <bjoseph@ti.com>
Subject: getc a single key-press without hitting <return>?
Message-Id: <3AC3DB75.8D99837A@ti.com>
I want to grab one character at a time from STDIN. There are many ways to do
it:
$c = getc;
read STDIN, $c, 1;
$c = <STDIN>;
The problem I'm having is that none of these methods return control to the
program until <enter> is pressed. I want the code to: wait for a single
key-press, put that character in a variable, and continue the thread.
Does anybody know a way to do this?
-Brian
------------------------------
Date: Fri, 30 Mar 2001 01:52:38 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: getc a single key-press without hitting <return>?
Message-Id: <3ac3e618.66718159@news.erols.com>
On Thu, 29 Mar 2001 17:03:49 -0800, Brian Joseph <bjoseph@ti.com>
wrote:
>The problem I'm having is that none of these methods return control to the
>program until <enter> is pressed. I want the code to: wait for a single
>key-press, put that character in a variable, and continue the thread.
perldoc -q "How do I read just one key without waiting for a return
key?"
------------------------------
Date: Fri, 30 Mar 2001 01:53:37 GMT
From: garyp@bgm.com.au (Gary Perkins)
Subject: NT file permissions
Message-Id: <3ac3e68e.8978700@wa.nnrp.telstra.net>
Howdy,
I'm a bit of a newbie to perl but am trying. I have installed the
Oracle Apache based http server on one of our NT machines and am
trying to run a perl cgi script to display a list of files in a
directory on another server (within the same NT domain). This script
runs fine from the command prompt but fails from the browser. Look
like a permissions thing to me. I tried to get the apache service to
run under another username but it wont even start.
Any ideas?
Cheers
Gary Perkins
------------------------------
Date: Fri, 30 Mar 2001 08:39:47 +0800
From: "yc" <leongyc@tp.edu.sg>
Subject: Re: Perl newbie
Message-Id: <3ac3d0d8.0@news-svr.tp.ac.sg>
Hi Rafael,
Thanks for your enlightenment.
How can I learn obsfuscative powers of Perl ?
Rgds,
YC
"Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
news:slrn9c3ajs.a84.rgarciasuarez@rafael.kazibao.net...
> yc wrote in comp.lang.perl.misc:
> > Hi,
> >
> > I'm new and trying to learn perl.
> >
> > Below is a simple script I've created:
> >
> > open (File_Handle, "File");
>
> Note : you should _always_ check return values of system calls.
> open (File_Handle, "File") or die "Can't open File: $!\n";
>
> > while (<File_Handle>)
> ^^^^^^^^^^^^^
> You read a line here (the contents of the line is stored in $_)
>
> > {
> > @array=split (/:/, <File_Handle>);
> ^^^^^^^^^^^^^
> and you read another line here. That's the problem.
> You want
> @array=split (/:/, $_);
> or, more concisely,
> @array=split /:/;
>
> > print ("$array[0]\n");
> > }
>
> Post-scriptum: For your enjoyment, and to enlighten you about the
> obsfuscative powers of Perl's conciseness, here's a one-line version
> of your script:
> perl -alnF: -e 'print$F[0]' File
>
> --
> Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 30 Mar 2001 11:05:47 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: perl script to browse web site
Message-Id: <6NQw6.5713$45.32870@newsfeeds.bigpond.com>
This question gets asked so often it should be in a faq.
The following code fragments get web page and store/send a cookie!!
You can use this code to emulate what a browser.
1. Open a Web page and store a cookie in a file.
use LWP::UserAgent;
use HTTP::Cookies;
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
$ua->timeout(30);
$req = new HTTP::Request 'GET' => 'http://www.somesite.com'; #change
as apprporiate
$req->header('Accept' => 'text/html');
$res = $ua->request($req);
if ($res->is_success) {
$cookie_jar = new HTTP::Cookies( ignore_discard =>TRUE);
$cookie_jar->extract_cookies($res);
$cookie_jar->save('/usr/local/cookie_jar); #change as
appropriate
#web page is now in the variable$res
}
2. Open a Web page and send the stored cookie
$ua = new LWP::UserAgent;
$ua->agent("$0/0.1 " . $ua->agent);
$ua->timeout(30);
$req = new HTTP::Request 'GET' =>
'http://www.somesite.com/';
$req = new HTTP::Request 'GET' =>
'http://www.somesite.com/somepage.htm'; #change as appropriate
$req->header('Accept' => 'text/html');
$cookie_jar = new HTTP::Cookies( ignore_discard =>TRUE);
$cookie_jar->load('/usr/local/cookie_jar') #change as
appropriate
$cookie_jar->add_cookie_header($req);
$res = $ua->request($req);
if ($res->is_success) {
#web page is now in the variable $res
}
Simulating a logon to Yahoo is a bit more tricky:
http://www.ics.uci.edu/pub/websoft/libwww-perl/archive/2000h2/0576.html
gtoomey
------------
<strshn99@mail.usa.com> wrote in message
news:9a0240$1tv$1@news.netmar.com...
>
> Hello all,
>
> I am running perl on Linux and NT and wonder if there are any perl scripts
> out
> there that will allow me to point to a web site. What i need to do is to
> fill in a search form on a web site with the words to search and then
cause
> that form to be submitted to the website along with some cookies value.
>
> So the perl script I am looking for must be able to send form information
as
> well as cookies information. Does anyone know where I can get a copy of
> such
> programs? or info on how to write one? Also, I have to run the
> same perl scripts on WinNT
>
> Appreciate you help, please also CC me a copy to my email if possible
> strshn99@mail.usa.com
>
>
> ----- Posted via NewsOne.Net: Free (anonymous) Usenet News via the
eb -----
> http://newsone.net/ -- Free reading and anonymous posting to 60,000+
groups
> NewsOne.Net prohibits users from posting spam. If this or other posts
> made through NewsOne.Net violate posting guidelines, email
abuse@newsone.net
------------------------------
Date: Thu, 29 Mar 2001 18:01:59 -0600
From: brian d foy <comdog@panix.com>
Subject: Re: Provo Perl Mongers Meeting
Message-Id: <comdog-B2BAE5.18015929032001@news.panix.com>
In article <slrn9c72ks.3ga.dha@panix2.panix.com>, dha@panix2.panix.com
(David H. Adler) wrote:
> On Thu, 29 Mar 2001 09:29:21 +0100, Paul Boardman <peb@bms.umist.ac.uk> wrote:
> >Alan Young wrote:
> >>
> >> If this is OT I'm sure y'all'll let me know.
> >>
> >> We are having a meeting of the Provo Perl Mongers tonight at the Orem
> >> Public Library at 7pm for anyone who is interested.
> >
> >I'd say it was pretty off topic. esp since many readers of this
> >newsgroup don't come from the same country as you!
>
> I think it's on topic... you may disagree with the breadth of its
> distribution, though... :-)
i personally like to see that Perl user groups are alive and well ;)
--
brian d foy <comdog@panix.com>
------------------------------
Date: Fri, 30 Mar 2001 00:38:19 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: regexp with multiple \n?
Message-Id: <tc7lbrgges1610@corp.supernews.com>
Ti Leggett <leggett@americasm01.nt.com> wrote:
> Mark Grimshaw wrote:
>> Hi,
>>
>> I'm capturing input from a FORMs-based bulletin board. If $message is
[snip]
>> $message =~ s/(\n){2,}/<P>/g;
>> $message =~ s/\n/<BR>/g;
>>
>> However, the first code produces no result. Any solutions?
> It seems to me (and I'm by no means a guru), that if you're reading line by
> line this won't have any effect. However, if you're slurping in the whole
[snip]
Line at a time versus slurp mode is irrelevant. The text with which
Mark is dealing is already in a particular variable.
Chris
--
Christopher E. Stith
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.
------------------------------
Date: Fri, 30 Mar 2001 01:55:10 GMT
From: Borgy <no@spam.com>
Subject: Re: splitting
Message-Id: <3AC3E76D.4C7A03A4@spam.com>
See this is the problem I have. When the cookie is written to file I get
the following all one one line:
1:19.99:Abba Greatest Hits 1:17.99:Blondie Parallel Lines
There are three elements to each part: quantity, price and product. The
problem I am having is getting a line return after the first part. I need
to split it up like so:
1:19.99:Abba Greatest Hits
1:17.99:Blondie Parallel Lines
The fact that there is no delimeter at the end of the first, ie. after the
first CD, is screwing me up. Question simply put is how to I get a file
like the second example out of the first. Thanks very much for the help
people :-)
Borgy
__________________________
Wyzelli wrote:
> "Borgy" <no_spam@nospam.com> wrote in message
> news:3AC29F30.E49F2C40@nospam.com...
> > This is driving me crazy. I need to split up a cookie and write it to
> a
> > file that is in this format:
> >
> > 1:17.99:Rolling Stones CD 1:19.99:Deep Purple CD
> >
> > The annoying thing is that there is a space after the the pattern 'CD'
> > instead of a line break or a colon delimeter. How can I split it up so
> > that it writes to a file llike so:
> >
> > 1:17.99:Rolling Stones CD
> > 1:19.99:Deep Purple CD
> >
> > Any help would be appreciated. Please post to group.. thanks Borgy :-)
> >
> > Here is what I have:
> > ---------------
> >
> > if (&GetCookies('mycart')) {
> >
> > $viewcookie = "$Cookies{'mycart'}";
> > $tobeadded = $viewcookie;
> > @array = split(/\|/, $viewcookie);
> >
> > $RemoveNumber=0;
> >
> > open(file, "> temp.txt");
>
> open (FILE, '>temp.txt') or die "cannot create file temp.txt : $!";
>
> #By convention filehandles are all uppercase - prevents conflict with
> future reserved words, and is easier to read
>
> You check whether the file open succeeded, and if not WHY not ($! is the
> error). Hint... you may not be working where you think you are working,
> so maybe you should use a full file path.
>
> > foreach $array (@array) {
> > ($quantity, $price, $item) = split(/:/ , $array);
> > print file("$quantity $item $price\n"); # < -does NOT work... ie
> won't print to file???
>
> print FILE "$quantity $item $price\n";
>
> Does the file exist?
>
> > print "$quantity $item $price<br>"; # <- prints to browser just
> fine
> >
> >
> > open(file, "> temp.txt");
> > print file ("@array\n");
> > close (file);
> >
> > $RemoveNumber++;
> >
> > }}}
>
> Wyzelli
> --
> @x='07411711511603209711011111610410111403208010111410803210409709910710
> 1114'=~/(...)/g;
> print chr for @x;
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 592
**************************************