[24027] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6224 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 6 00:05:39 2004

Date: Fri, 5 Mar 2004 21:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 5 Mar 2004     Volume: 10 Number: 6224

Today's topics:
        Changing output <shotoku.taishi@virgin.net>
    Re: Changing output <emschwar@pobox.com>
    Re: Changing output (Walter Roberson)
    Re: Changing output <gnari@simnet.is>
    Re: Changing output <bmb@ginger.libs.uga.edu>
        Executing commands. <connell@freebreakfast.co.uk>
    Re: Executing commands. <ittyspam@yahoo.com>
    Re: hash keys <gnari@simnet.is>
        No more handles error with DBD::DB2 on Linux <shah@typhoon.xnet.com>
    Re: No more handles error with DBD::DB2 on Linux <734562323@yahoo.de>
        open (FAILEHANDLER, ">>$filename")  what is the rong wi (Sameh Abdelatef)
    Re: open (FAILEHANDLER, ">>$filename")  what is the ron <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: Operation not permitted (Sam)
    Re: Perl on Win32, with Apache <arthur0421@163.com>
        Perl program and database locked but alive <theforce@forcet.net>
        Read This....Please.... <BobLoblaw@rogers.com>
    Re: References Subroutines and Arrays <usenet@morrow.me.uk>
    Re: Replacing 1500 bytes at a variable offset <krahnj@acm.org>
        scheduling a perl script (mike)
    Re: Sys::Syslog under Solaris (David Efflandt)
    Re: Unpack binary file with C Struct to text? <pkrupa@redwood.rsc.raytheon.com>
        Unwanted newline or eol between fields (Suzie Wilks)
    Re: Unwanted newline or eol between fields <ittyspam@yahoo.com>
    Re: waitpid interrupted problem <jg2002@aptsolutions.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 5 Mar 2004 22:47:53 -0000
From: "Euro Millions" <shotoku.taishi@virgin.net>
Subject: Changing output
Message-Id: <c2b0gl$loc$1@news6.svr.pol.co.uk>

Hi there

What I would like to do is simple (that is if you know it)

I have a CSV text file (comma separated file) which contains the following
info:

Language, Greeting,
English, Hello,
German, Hallo,
Spanish, Hola,
Japanese, Konnichiwa,

I would like Perl to create an output file which looks as follows:

Language,Language2, Language3, Langauge4, Greeting,Greeting2, Greeting3,
Greeting4
English, German, Spanish, Japanese, Hello, Hallo, Hola, Konnichiwa

How can I get Perl to read this text file?
What is the easiest way of going about it?
Which Perl Modules would you recommend?

Thank you in advance for your assistance.

Thanks

Mike






------------------------------

Date: Fri, 05 Mar 2004 17:14:09 -0700
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Changing output
Message-Id: <eton06uomr2.fsf@fc.hp.com>

"Euro Millions" <shotoku.taishi@virgin.net> writes:
> What I would like to do is simple (that is if you know it)
>
> I have a CSV text file (comma separated file) which contains the following
> info:
>
> Language, Greeting,
> English, Hello,
> German, Hallo,
> Spanish, Hola,
> Japanese, Konnichiwa,
>
> I would like Perl to create an output file which looks as follows:
>
> Language,Language2, Language3, Langauge4, Greeting,Greeting2, Greeting3,
> Greeting4
> English, German, Spanish, Japanese, Hello, Hallo, Hola, Konnichiwa
>
> How can I get Perl to read this text file?

perldoc -f open
perldoc perlsyn (look for the '<>' operator)

> What is the easiest way of going about it?

I'd use a hash.

> Which Perl Modules would you recommend?

You don't need any.  You could get ultra-fancy and try a
matrix-oriented module or some such, but there's no point at all to
doing so.

FYI, the way to get the best response out of this group is to try it
yourself, and post the code.  That way, you may well figure it out on
your own, and if you don't, we'll have a starting point to work with.

Posters on clpm don't take kindly to someone saying, essentially,
"please write my program for me."  That may not have been what you
meant, but it's what it'll look like to many of the best contributors
here.  When you post code, you're saying, "Here, I've made an effort,
but I got stuck.  What's wrong with this?"  It also gives people the
opportunity to suggest other improvements in your code you may not
have thought about yet.

The best example is a 10-20 line program that exhibits your problem
clearly.

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


------------------------------

Date: 6 Mar 2004 00:21:43 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: Changing output
Message-Id: <c2b5in$aqb$1@canopus.cc.umanitoba.ca>

In article <c2b0gl$loc$1@news6.svr.pol.co.uk>,
Euro Millions <shotoku.taishi@virgin.net> wrote:
:What I would like to do is simple (that is if you know it)

:I have a CSV text file (comma separated file) which contains the following
:info:

:Language, Greeting,
:English, Hello,
:German, Hallo,
:Spanish, Hola,
:Japanese, Konnichiwa,

:I would like Perl to create an output file which looks as follows:

:Language,Language2, Language3, Langauge4, Greeting,Greeting2, Greeting3,
:Greeting4
:English, German, Spanish, Japanese, Hello, Hallo, Hola, Konnichiwa


If the exact order of the outputs does not matter (as long as the pairs
are correct):


my %phrases;

while (<>) {
  my ($lang, $phrase) = split /,/;
  $phrases{$lang} = $phrase;
}

my $numphrase = scalar(keys %phrases);

{
  my $heading = 'Language,';
  $heading .= "Language$_, " for (2..$numphrase);
  $heading .= "Greeting";
  $heading .= ",Greeting2" if $numphrase >= 2;
  $heading .= ", Greeting$_" for (3..$numphrase);
  $heading .= "\n";
  print $heading;
}

{
  my $body = join ', ', keys %phrases;
  $body .= ", $phrases{$_}" for keys %phrases;
  $body .= "\n";
  print $body;
}



But your program would be easier if you could get rid of the
strange requirement for not having a space betweeen Language,Language2
and Greeting,Greeting2 ...
-- 
   I wrote a hack in microcode,
   with a goto on each line,
   it runs as fast as Superman,
   but not quite every time!                 -- Don Libes et al.


------------------------------

Date: Sat, 6 Mar 2004 00:17:57 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Changing output
Message-Id: <c2b89v$pqv$1@news.simnet.is>

"Euro Millions" <shotoku.taishi@virgin.net> wrote in message
news:c2b0gl$loc$1@news6.svr.pol.co.uk...

[snip problem]

it is usually better if you  post what you have tried, and tell us
why it is not good enough

but here a few pointers anyways:

you might want to open the file with open()
dont forget the check if the open failed, then call die()
use a while loop to read the lines in succession
   while (<FILEHANDLE>) {
use split() on each line to get the individual columns
and store the values into an array
when all lines read close() the file

now loop over the array elements, printing them out

if you dont know all these functions, use perldoc:
  perldoc -f open
  perldoc -f close
  perldoc -f split
  perldoc perlsyn
  perldoc perlop

there are some modules on CPAN that deal with CSV
(search.cpan.org)

although usually the values are enclosed in quotes in CSV
  "bla","foo","bar"

good luck

gnari






------------------------------

Date: Fri, 5 Mar 2004 21:28:21 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Changing output
Message-Id: <Pine.A41.4.58.0403052114580.17250@ginger.libs.uga.edu>

On Fri, 5 Mar 2004, Euro Millions wrote:
> What I would like to do is simple (that is if you know it)
>
> I have a CSV text file (comma separated file) which contains the following
> info:
>
> Language, Greeting,
> English, Hello,
> German, Hallo,
> Spanish, Hola,
> Japanese, Konnichiwa,
>
> I would like Perl to create an output file which looks as follows:
>
> Language,Language2, Language3, Langauge4, Greeting,Greeting2, Greeting3,
> Greeting4
> English, German, Spanish, Japanese, Hello, Hallo, Hola, Konnichiwa

Okay, now tell us what you REALLY want to do. :-)

Obviously, you don't really have that file, because writing a program for
that purpose just doesn't make sense.  So, do you really have a file that
contains dozens of languages?  Is "Greeting" always "Hello", not "Good
morning", "G'day", "'Sup"?  I assume your list contains other things, like
"Thank you", "Please", etc.

The question as it stands is so trivial that I'm compelled to think you're
leaving out the parts that matter.

Regards,

Brad



------------------------------

Date: Fri, 5 Mar 2004 21:21:30 -0000
From: "Connell Gauld" <connell@freebreakfast.co.uk>
Subject: Executing commands.
Message-Id: <c2aqq8$fa1$1@newsg4.svr.pol.co.uk>

Hey,
I'm trying to right a perl script on Linux which will run a certain
executable.
Is there a Perl command which will do this eg:
command "/bin/something parameters";

Thanks for any help.
Connell Gauld




------------------------------

Date: Fri, 5 Mar 2004 16:34:22 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Executing commands.
Message-Id: <20040305163035.I27834@dishwasher.cs.rpi.edu>

On Fri, 5 Mar 2004, Connell Gauld wrote:

> Hey,
> I'm trying to right a perl script on Linux which will run a certain
> executable.
> Is there a Perl command which will do this eg:
> command "/bin/something parameters";
>
> Thanks for any help.
> Connell Gauld

There are several.

$s = system ("/bin/something parameters"); will call whatever shell you're
using, and return the exit code of 'something'.

$s = system ("/bin/something", "parameter1", "paremeter2"); will call
'something' directly, bypassing the shell, and feeding it the paremeters.
Again returns the exit code.

$s = `/bin/something parameters`; returns the output of the command.

@s = `/bin/something parameters`; returns the output of the command as an
array, with each element containing one line of output.


Then there are pipes, which are mildly more complicated.  If you just want
to run an external program, chances are you don't need them.

Paul Lalli


------------------------------

Date: Fri, 5 Mar 2004 19:03:27 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: hash keys
Message-Id: <c2airq$n63$1@news.simnet.is>

"BigDaDDY" <ihatespam@hotmail.com> wrote in message
news:104h9e6keqhjqc4@corp.supernews.com...
> I am wondering if it is possible for me to have a hash with numeric keys
> and a string as the value for each corresponding key.  The reason is, is
> the results of a mathematical calculation are going to determine the key.
>
> The program below seems to populate the hash %jay with the correct values,
> but I am not sure how to get at them.  If I calculate the value of $angle
> through a series of complex equations, then how can I get at $jay{$angle},
> which is what I really want to print?
>
[snip exaccly same program posted earlier today]

did you not read the reply I made to your previous post?

if you do not like the answers, do not just start a new thread,
more or less repeating your question. rather, follow up on the answers,
with more info or requests for clarification

gnari






------------------------------

Date: Fri, 5 Mar 2004 21:47:59 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: No more handles error with DBD::DB2 on Linux
Message-Id: <c2asif$hko$1@flood.xnet.com>


Folks,

  I have DB2 UDB 7.2 EE installed on AIX 5.2 system. I think I am at
  latest fixpack, see output of lslpp below. I have also installed DB2
  UDB 7.2 EE on RedHat Linux 7.3 I believe that is also at the latest
  fix pack, see rpm output below.

  The database is on AIX system and on the Linux system it is cataloged 
  as remote database.

  I have perl/TK GUI that uses DBD::DB2 interface to access the database.
  If I run the GUI from AIX system (server) I have no problems.  If I
  run GUI from Linux system (client), then after using it for some time
  I get following error:

  CLI0129E  No more handles.

  Last time I got this error I ran following commands on the Server:

  db2 list applications
  db2 get snapshot for applications on dbname

  There was only one connection to the database and that was the GUI,
  the application also had only one section.

  I have checked my code and I always call finish() method on the
  statement handle after I am done. All the access to the database is
  done by calling various functions. When the GUI is started it connects
  to the database. Each function creates and prepares the statement and then
  executes it and then calls finish() before returning.


  I am not sure why I am getting this error from the Linix client.



# lslpp -l "db2_07_01*"
  Fileset                      Level  State      Description         
  ----------------------------------------------------------------------------
Path: /usr/lib/objrepos
  db2_07_01.adt.rte         7.1.0.72  COMMITTED  Application Development Tools
                                                 (ADT) 
  db2_07_01.adt.samples     7.1.0.72  COMMITTED  ADT Sample Programs 
  db2_07_01.cdb             7.1.0.72  COMMITTED  Control Database 
  db2_07_01.cj              7.1.0.72  COMMITTED  Java Common files 
  db2_07_01.client          7.1.0.72  COMMITTED  Client Application Enabler 
  db2_07_01.cnvucs          7.1.0.72  COMMITTED  Code Page Conversion Tables -
                                                 Uni Code Support 
  db2_07_01.conn            7.1.0.72  COMMITTED  Connect 
  db2_07_01.conv.jp         7.1.0.40  COMMITTED  Code Page Conversion Tables -
                                                 Japanese 
  db2_07_01.conv.kr         7.1.0.40  COMMITTED  Code Page Conversion Tables -
                                                 Korean 
  db2_07_01.conv.sch        7.1.0.40  COMMITTED  Code Page Conversion Tables -
                                                 Simplified Chinese 
  db2_07_01.conv.tch        7.1.0.40  COMMITTED  Code Page Conversion Tables -
                                                 Traditional Chinese 
  db2_07_01.cs.drda         7.1.0.72  COMMITTED  Communication Support - DRDA
                                                 Application Server 
  db2_07_01.cs.ipx          7.1.0.72  COMMITTED  Communication Support - IPX 
  db2_07_01.cs.rte          7.1.0.72  COMMITTED  Communication Support - TCP/IP
  db2_07_01.cs.sna          7.1.0.72  COMMITTED  Communication Support - SNA 
  db2_07_01.ctsr            7.1.0.72  COMMITTED  Control Server 
  db2_07_01.das             7.1.0.72  COMMITTED  Administration Server 
  db2_07_01.db2.engn        7.1.0.72  COMMITTED  Engine 
  db2_07_01.db2.rte         7.1.0.72  COMMITTED  Run-time Environment 
  db2_07_01.db2.samples     7.1.0.40  COMMITTED  Sample Database Source 
  db2_07_01.db2tie           7.2.0.2  COMMITTED  Text Information Extender
  db2_07_01.elic            7.1.0.72  COMMITTED  Product Signature for UDB
                                                 Enterprise Edition 
  db2_07_01.jdbc            7.1.0.72  COMMITTED  Java Support 
  db2_07_01.ldap            7.1.0.72  COMMITTED  DB2 LDAP Support 
  db2_07_01.spb             7.1.0.72  COMMITTED  Stored Procedure Builder 
  db2_07_01.tspf            7.1.0.72  COMMITTED  Transformer Stored Procedure
                                                 Files 
  db2_07_01.wcc             7.1.0.72  COMMITTED  Control Center 

----------------------------------------------------------------------
# rpm -qa | grep db2
db2-2.4.14-10
db2das71-7.1.0-68
db2cnvc71-7.1.0-68
db2-devel-2.4.14-10
db2jdbc71-7.1.0-68
db2cj71-7.1.0-68
db2adt71-7.1.0-68
db2crte71-7.1.0-68
db2cnvj71-7.1.0-68
db2cliv71-7.1.0-68
db2engn71-7.1.0-68
db2conn71-7.1.0-68
db2smpl71-7.1.0-68
db2cnvt71-7.1.0-68
db2rte71-7.1.0-68
db2wcc71-7.1.0-68
db2adts71-7.1.0-68
db2cdrd71-7.1.0-68
db2cnvk71-7.1.0-68
db2cucs71-7.1.0-68
db2repl71-7.1.0-68
db2elic71-7.1.0-68

-- 
Hemant Shah                           /"\  ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com       \ /  --------------------- 
                                       X     against HTML mail
TO REPLY, REMOVE NoJunkMail           / \      and postings      
FROM MY E-MAIL ADDRESS.           
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.


------------------------------

Date: Fri, 05 Mar 2004 21:30:55 -0500
From: L D Jones <734562323@yahoo.de>
Subject: Re: No more handles error with DBD::DB2 on Linux
Message-Id: <404937DF.D9809E19@yahoo.de>

Hemant Shah wrote:
> 
> Folks,
> 
>   I have DB2 UDB 7.2 EE installed on AIX 5.2 system. I think I am at
>   latest fixpack, see output of lslpp below. I have also installed DB2
>   UDB 7.2 EE on RedHat Linux 7.3 I believe that is also at the latest
>   fix pack, see rpm output below.
> 
>   The database is on AIX system and on the Linux system it is cataloged
>   as remote database.
> 
>   I have perl/TK GUI that uses DBD::DB2 interface to access the database.
>   If I run the GUI from AIX system (server) I have no problems.  If I
>   run GUI from Linux system (client), then after using it for some time
>   I get following error:
> 
>   CLI0129E  No more handles.

I suspect your problem is not with DBD::DB2. try comp.databases.ibm-db2


------------------------------

Date: 5 Mar 2004 16:08:17 -0800
From: samehabdelatef@yahoo.com (Sameh Abdelatef)
Subject: open (FAILEHANDLER, ">>$filename")  what is the rong with that
Message-Id: <a2f806f.0403051608.4f6270bf@posting.google.com>

Dear perl experts,

I used to use[ open (FAILEHANDLER, ">>$filename");] to open and add
new lines to $filename, but it didn't work any more. The perl version
is 5.8.1. When I try  [ open (FAILEHANDLER, ">$filename");] it's work
but the content of $filename is deletd.
Any help will be appreciated.


------------------------------

Date: Fri, 5 Mar 2004 16:23:58 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: open (FAILEHANDLER, ">>$filename")  what is the rong with that
Message-Id: <um5b2c.116.ln@goaway.wombat.san-francisco.ca.us>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

[comp.lang.perl is dead, baby]

On 2004-03-06, Sameh Abdelatef <samehabdelatef@yahoo.com> wrote:
>
> I used to use[ open (FAILEHANDLER, ">>$filename");] to open and add
> new lines to $filename, but it didn't work any more.

Define ''didn't work''--post a short script that duplicates the problem,
and what happens when you run the script.

> When I try  [ open (FAILEHANDLER, ">$filename");] it's work
> but the content of $filename is deletd.

Well that's what > means!  Thus addressing the above problem is likely
to be more fruitful than overwriting your file.

- --keith

- -- 
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom

-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFASRodhVcNCxZ5ID8RAmG5AKCYVg8fLCSQXcNxS6HaYkYEzp8+PgCaAk5N
0icT3FC6Jw9d+SmlRJ16HlE=
=olqQ
-----END PGP SIGNATURE-----


------------------------------

Date: 5 Mar 2004 11:49:33 -0800
From: dahirolla2@hotmail.com (Sam)
Subject: Re: Operation not permitted
Message-Id: <9aa32c3.0403051149.2f45a87a@posting.google.com>

Thanks for all the input. A friend of mine took a look at the perl
script and thought it might be a permissions problem, and sure enough,
when I set the permissions higher, I no longer received the error
message. For anyone who finds this while looking for the same
solution, here's the relevant code change:

die "Unable to chmod file in spooling area\n" .
	 "chmod (0700, \"$TEMP/$temp2\"): $!"
	    unless (chmod (0700, "$TEMP/$temp2"));

Change those two 0700's to something higher...if you're a lazy slacker
like me, 777 will work. That piece of code sets the permissions on the
data file, and if it is too strict then your html interface won't be
able to submit them to hylafax.

(The default location for this file is /usr/local/smbfax/smbfax, and
it is a perl script.)

Again, thanks to those who've given me their consideration, and
forgive me if I've posted slightly off-topic for this group.

-Sam


------------------------------

Date: Sat, 06 Mar 2004 10:28:14 +0800
From: Regent <arthur0421@163.com>
Subject: Re: Perl on Win32, with Apache
Message-Id: <c2bd13$2khq$1@mail.cn99.com>

gnari wrote:

> "gnu valued customer" <tlviewer@yahoo.com> wrote in message
> news:5WW1c.62000$C65.27731@nwrddc01.gnilink.net...
> 
>>hello,
>>"Regent" <arthur0421@163.com> wrote in message
>>news:c29c2d$1pkd$1@mail.cn99.com...
>>
>>>I have a Perl-based web site, of which each script must "require" a
>>>commonstuff.pl that simply defines some common subroutines and
>>>constants. If I don't put commonstuff.pl in any of the @INC paths, how
>>>should I efficiently include it in each script, avoiding such lines as
>>>
>>>   require "d:/wwwroot/cgi-bin/commonstuff.pl";
> 
> [snip]
> 
> 
>>use File::Basename;
>>chdir(dirname( $0 ));
>>require("commonstuff.pl");
>>
>>No hard-coded path here, so it might be what you want.
> 
> 
> will not work on all webserver setups, so try it before changing
> 3000 scripts.
> 
> anyways the chdir is disgusting. why not:
>     use File::Basename;
>     require(dirname($0) . "commonstuff.pl");
> 
> gnari
> 
> 
> 
Yes, that's the solution, except that with -T in the shebang, I must do 
something with dirname($0) before concatenating the path with 
commonstuff.pl.

Thanks folks!

Regent


------------------------------

Date: Fri, 5 Mar 2004 19:05:15 -0800
From: "TF" <theforce@forcet.net>
Subject: Perl program and database locked but alive
Message-Id: <404947d8$1@nntp0.pdx.net>

Is there any way to intervene with a program that is still running, but
locked during database read/write subs, to see where the lockup is coming
from?
This problem cannot be repeated and is the result of web page data
corruption, or storage of said data.

Thanks




------------------------------

Date: Sat, 06 Mar 2004 03:29:16 GMT
From: "Bob" <BobLoblaw@rogers.com>
Subject: Read This....Please....
Message-Id: <gAb2c.106500$sl.84034@news01.bloor.is.net.cable.rogers.com>

        MAKE MONEY!!!MAKE MONEY!!!


MAKE THOUSANDS!!!

I found this on a bulletin board and decided to try it: I don't care
about the useless pre-fabricated crap this message usually says. All I
say is, it works. Continue pre-fab crap.

WELL GUESS WHAT!!!

Within seven days, I started getting money in the mail!! I
was shocked!! I figured it would end soon, but the money just kept
coming in. In my first week, I made about $25.00. By the end of the
second week I had
made a total of more than $1000.00!! In the third week I had more than
$10,000.00 and it's still growing!! This is now my fourth week and I
have made a total of $42,000.00 and it's still coming rapidly. It's
certainly worth $6.00 and six stamps, and I have spent more than that
on the lottery without ever  winning!!!

Let me tell you how this works and most important, why it
works..........
also make sure you print this out NOW, so you can get the information
off of it, as you will need it. I promise you that if you follow the
directions exactly that you
will start making more money than you thought possible by doing
something so easy!!

Suggestion: Read this entire message carefully!! (Print it out or
download it)

Follow the simple directions and watch the money come in!! It's easy.
It's legal. And, your investment is only $6.00 (Plus postage) !!!

IMPORTANT:

This is not a rip-off, it is decent; it's legal; and it is virtually
no risk - it really works!! If all the following instructions are
adhered to, you will receive extraordinary dividends.

PLEASE NOTE:

Please follow the directions EXACTLY, and $50,000 or more can be yours
in 20 to 60 days. This program remains successful because of the
honesty and
integrity of the participants. Please continue its success by
carefully adhering to
the instructions. You will now become apart of the Mail Order
business. You
are in the business of developing Mailing Lists. Many large
corporations are
happy to pay big bucks for quality lists. However, the money made from
the
mailing lists is secondary to income which is made from people like
you and me asking to be included in that list. Here are the four easy
steps to success.

STEP ONE:

Get six separate pieces of paper and write the following on
each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST."
Now get 6 U.S. $1.00 bills and place ONE inside of EACH of the six
pieces of paper so the bill will not be seen through the envelope (to
prevent thievery). Next, place one paper in each of the six envelopes
and seal them. You now should have six sealed envelopes, each with a
piece of paper stating the above phrase, your name and address, and a
$1.00 bill. What you are doing is creating a service.

THIS IS ABSOLUTELY LEGAL!!!!!

You are requesting a legitimate service and you are paying for it!!
Like
most of us I was a little skeptical and little worried about the legal
aspects
of it all. So I checked it out with the U.S. Post Office
(1-800-238-5355) and they
confirmed that it is indeed legal!!

Mail the six envelopes to the following addresses:


1) A. L. Alexander
12 Briggate
Elland Bridge
Elland
HX5 9DP
England

2) G. Burrows
1/264 Tor St
Toowoomba QLD
4350 Australia

3)S Luest
P.O. Box 366
Garden Grove, CA 92842
USA

4)R. Ansems
Gen. Foulkesstraat 5
4641 BW Ossendrecht
Netherlands

5)B. Loblaw
49 Gaydon Way
Brantford, On
Canada
N3T 6P7


STEP TWO:Now take the #1 name off the list that you see above, move
the other names up (six becomes 5, 5 becomes 4, and etc.) and add YOUR
NAME as number 6 on the list.

STEP THREE:
Change anything you need to but try to keep this article as close to
original as possible. Now post your amended article to at least 200
news groups. :
(I think there are close to 24,000 groups) All you need is 200, but
remember, the more you post, the more money you make!! This is
perfectly legal!! If you have any doubts, refer to Title 18 Sec. 1302
& 1341 of the Postal Lottery laws. Keep a copy of these steps for
yourself and whenever you need money, you can use it again, and again.
PLEASE REMEMBER that this program remains successful because of the
honesty and integrity of the participants and by their carefully
adhering to directions. Look at it this way. If you were of integrity,
the program will continue and the money that so many others have
received will come your way.

NOTE: You may want to retain every name and address sent to you,
either on a computer or hard copy and keep the notes people send you.
This VERIFIES that you are truly providing a service.  (Also, it might
be a good idea to wrap the $1 bill in dark paper to reduce the risk of
mail theft). So, as each post is downloaded and the directions
carefully followed, all members will be reimbursed for their
participation as a List Developer  with one dollar each. Your name
will move up the list geometrically so that when your name reaches the
#1 position you will be receiving thousands of dollars in CASH!!! What
an opportunity for only $6.00 ( $1.00 for each of the first six people
listed above) Send it now, add your own name to the list and you're in
business!!!


*****DIRECTIONS FOR HOW TO POST TO NEWS GROUPS!!!*****

STEP ONE: You do not need to re-type this entire letter to do your own
posting. Simply put your cursor at the beginning of this letter and
drag your
cursor to the bottom of this document, and select 'copy' from the edit
menu. This
will copy the entire letter into the computer's memory.

STEP TWO:
Open a blank 'notepad' file and place your cursor at the top
of the blank page. From the 'edit' menu select 'paste'. This will
paste a copy
of the letter into the notepad so that you will add your name to the
list.

STEP THREE:
Save your new notepad file as a text file. If you want to do your
posting in different settings, you'll always have this file to go back
to.

STEP FOUR:
You can use a program like "postXpert" to post to all the newsgroups
at once.
You can find this program at  <http://www.download.com>.

Use Netscape or Internet Explorer and try searching for various new
groups (on- line forums, message boards, chat sites, discussions.)

STEP FIVE:
Visit message boards and post this article as a new message by
highlighting the text of this letter and selecting paste from the edit
menu. Fill in the subject, this will be the header that everyone sees
as they scroll through the list of postings in a particular group,
click the post message button. You're done.

Congratulations!!!!!!

THAT'S IT!! All you have to do, and It Really works!!!

Best Wishes















------------------------------

Date: Fri, 5 Mar 2004 19:19:18 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: References Subroutines and Arrays
Message-Id: <c2ajrm$ngf$1@wisteria.csv.warwick.ac.uk>


ketema@ketema.net (Ketema) wrote:
> I am a little lost on how PERL handles references and array's,

Perl or perl... see the FAQ.

> especially when you pass and array to a subroutine.  Here is some code
> I have working to try and get a better understanding.  I read perldoc
> perlref, and I just don't see why this isn't working...Please help!
> 
> #I'm working with a mime::entity object from net::pop3

MIME::Entity, Net::POP3.

> &getParts($mime_entity);

At the risk of infuriating Tassilo :), don't call subs with & unless you
know you need those semantics, not least because it will confuse readers
of your code.

> sub getParts {
>   print "The wierd variable \@_ consists of: ".scalar @_."
> variables\n";

Rather than put "\n" on the end of every print, you want to learn to use
$\:

local $\ = "\n";

>   print "That passed variable: ".scalar @_->[0]." is a:
> ".ref(@_->[0])."\n";

@_ is an array, not an arrayref (it starts with @), so you access
elements with $_[0]. Yes, this is confusing :). This element, $_[0], is
a scalar; if it is an arrayref you can get at the array with @{ $_[0] }.

print 'that passed variable: ' . scalar $_[0] . 'is a: ' . ref $_[0];

>   #lets take the address of the passed array out of the hard to read
> @_ variable which is a list of everything passed to the sub
>   my $passedArray = \@_[0]; 		

my $passedArray = $_[0];

>   print "passedArray now holds the address for the passed object.
> passedArray holds: $passedArray\n";
>   print "The object located at the memory address passedArray holds is
> a: ". ref({$passedArray})."\n";

Oh my goodness me. What on Earth did you think that would do, and why
did you think that? That will attempt to construct an anonymous hash out
of $passedArray, fail because it doesn't have an even number of
elements, and pass a reference to that hash to the ref() function.

>   print "Lets do some Tests.\n";
>   print "\@_->{'ME_Parts'} attribute is a
> :".ref(@{@_[0]->{'ME_Parts'}});
>   print "passedArray->{'ME_Parts'} attribute is a
> :".ref(@$$passedArray->{'ME_Parts'});

I think you are completely confused. Read perldata and perlref again,
and try some simpler examples until you get the hang of it.

Ben

-- 
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based 
on the strictest morality.  [Samuel Butler, paraphrased]       ben@morrow.me.uk


------------------------------

Date: Sat, 06 Mar 2004 04:57:08 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Replacing 1500 bytes at a variable offset
Message-Id: <40495A12.CB82A210@acm.org>

"A. Farber" wrote:
> 
> How could I replace 1500 bytes in a file, please?
> They are not located at some fixed offset and also
> the amount of replacing bytes could be bigger or
> smaller than 1500. Here's what I am trying currently:
> 
> my $SEARCH = pack 'C*', map { hex } qw(
>         98 e6 52 ca db ce db 19 62 00 00 00
>         69 b5 40 0c 91 dc 6b 43 cf 00 00 00
>         5b 7d 92 c2 e1 ec f1 45 11 00 00 00
>         92 45 a3 64 0b ff e4 d9 a6 00 00 00
>         2e 0d cb 22 50 0e 92 5a 0f 00 00 00
>         4e d5 78 59 ee 1c 8b c6 cc 00 00 00
>         .... );
> 
> my $REPLACE = pack 'C*', map { hex } qw(
>         ff ff ff ff ff ff ff ff ff ff ff ff
>         69 b5 40 0c 91 dc 6b 43 cf 00 00 00
>         5b 7d 92 c2 e1 ec f1 45 11 00 00 00
>         92 45 a3 64 0b ff e4 d9 a6 00 00 00
>         2e 0d cb 22 50 0e 92 5a 0f 00 00 00
>         .... );
> 
> use constant KEYSIZE => length $SEARCH;
> 
> while (sysread $upload, $chunk, KEYSIZE) {
>         $both = $prev . $chunk;
>         if ($both =~ s/$SEARCH/$REPLACE/o) {
>                 die "syswrite failed: $!"
>                         unless length $both == syswrite $fh, $both;
>                 undef $prev;
>         } else {
>                 die "syswrite failed: $!"
>                         unless length $prev == syswrite $fh, $prev;
>                 $prev = $chunk;
>         }
> }
> # don't forget to print the last line
> die "syswrite failed: $!"
>         unless length $prev == syswrite $fh, $prev;
> 
> Unfortunately the regex doesn't compile, probably
> because it doesn't like the binary data I feed to it!

It is not that the data is binary, it is because some of the characters
are special to regular expressions.  Use the quotemeta escape to fix it.

s/\Q$SEARCH/$REPLACE/o


John
-- 
use Perl;
program
fulfillment


------------------------------

Date: 5 Mar 2004 20:53:49 -0800
From: s99999999s2003@yahoo.com (mike)
Subject: scheduling a perl script
Message-Id: <dfd17ef4.0403052053.632e2e8e@posting.google.com>

hi

i wrote a script that is supposed to check a directory and see if
there is a file named "test.txt" there and if there is , use ftp to
transfer the file to another server and then remove the file from the
directory.
I had scheduled a job in windows to poll for this directory looking
for "test.txt" every month on day 8, 9 and 10 and 11, because test.txt
will arrive anytime during 8,9 and 10. On the 11th, my script will
poll the directory and if there is still no test.txt, will alert the
administrator.

How can i implement in perl such that on the 11th, my script will not
mistake that test.txt is not there while in fact, it has already been
transfered to another server and removed after transfered?
I thought of not removing test.txt after transfered but if the file
arrived on the 8th, then on the 9th i would do another identical
transfer.

I also thought of using a "status" file. Something like

open ( STATUS , "> status.out");
print STATUS "0";

then if test.txt arrrives, do the transfer, remove the file and update
STATUS.
Is this the correct way to do ??
thanks


------------------------------

Date: Fri, 5 Mar 2004 19:31:02 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Sys::Syslog under Solaris
Message-Id: <slrnc4hlbl.dlr.efflandt@typhoon.xnet.com>

On Fri, 5 Mar 2004 14:09:51 +0100, Loic Minier <lool@dooz.org> wrote:
>    Hi,
> 
>  I have trouble using the Sys::Syslog package under Solaris.  If I use
>  'stream', I don't get anything logged, and if I log via udp instead,
>  all my logs are prefixed with the program name ($ident).  This doesn't
>  happen with other programs running on the same host.
> 
>  Here's the relevant Perl :
>  use Sys::Syslog qw(:DEFAULT setlogsock);
>  #setlogsock('stream'); # doesn't work
>  setlogsock('inet'); # or udp
>  syslog('info', "test\n");
> 
>  Any idea on how to get stream at work?  Or to get rid of the prefix?

I am not sure about 'stream' and do not have root access on my Solaris ISP 
to check logs, but for Linux where I have a variable to indicate whether 
it should log I have:

# grouped with other variable settings
# Flag for Unix syslog, 1 (yes), 0 (no)
BEGIN { $main::syslog = 1; }


# farther down...
# Name of this script
if ($0 =~ m|/([^/]+)$|) { $id = $1; } else { $id = $0; }

# Initialize local system log (unix)
BEGIN {
    if ($main::syslog) {
        use Sys::Syslog qw(:DEFAULT setlogsock);
        setlogsock 'unix' || die "Can't setlogsock";
    }
}

sub mylog {
    my $msg = shift;
    chomp $msg;
    if ($syslog) { syslog('info',"$id\[$$]:$msg"); closelog(); }
    # along w/other routines to optionally log to file, etc.
}

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


------------------------------

Date: Fri, 05 Mar 2004 23:10:45 +0000
From: "Peter A. Krupa" <pkrupa@redwood.rsc.raytheon.com>
Subject: Re: Unpack binary file with C Struct to text?
Message-Id: <WN72c.7$QB4.4@dfw-service2.ext.ray.com>

Your main problem here isn't Perl:  you can't unpack the string (i.e., 
".info") because what you have is a reference to the string class 
instance, not the string itself.

You can, however unpack ".where" as an unsigned int:

perl -e "$x=\"\x00\x27\xc0\x8c\";$l=unpack('I',$x);print $l"
2361403136

Or, conversely, as a signed int:

perl -e "$x=\"\x00\x27\xc0\x8c\";$l=unpack('i',$x);print $l"
-1933564160

If you ~did~ have an ASCII string in binary data, here's how you'd print 
it out:

perl -e "$x=\"\x4a\x75\x73\x74\x20\x61\x6e\x6f\x74\x68\x65\x72\x20\x50\x65\x
72\x6c\x20\x68\x61\x63\x6b\x65\x72\x2e\";print(unpack('a*',$x))"
Just another Perl hacker.



------------------------------

Date: 5 Mar 2004 13:37:55 -0800
From: wazopst@yahoo.com (Suzie Wilks)
Subject: Unwanted newline or eol between fields
Message-Id: <c2e2cf05.0403051337.20423df5@posting.google.com>

This seems so simple, but it's driving me crazy.

I have a file that looks a bit like this:

 -0.15     -0.15     -0.20
 -0.20     -0.20     -0.15
 -0.15     -0.15     -0.15


         0.002
                   0.007
                             0.038

But I'd like it to be:

-0.15     -0.15     -0.20
 -0.20     -0.20     -0.15
 -0.15     -0.15     -0.15
 0.002    0.007     0.038

(Empty lines between lines are ok. ) I guess I'm supposed to get rid
of a newline if the next line starts with whitespace, but my regexps
just aren't doing it. (Or get rid of a newline if it's followed by
whitespace?)

Any thoughts?
Thanks very much!


------------------------------

Date: Fri, 5 Mar 2004 16:49:39 -0500
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Unwanted newline or eol between fields
Message-Id: <20040305164900.C27834@dishwasher.cs.rpi.edu>

On Fri, 5 Mar 2004, Suzie Wilks wrote:

> Date: 5 Mar 2004 13:37:55 -0800
> From: Suzie Wilks <wazopst@yahoo.com>
> Newsgroups: comp.lang.perl.misc
> Subject: Unwanted newline or eol between fields
>
> This seems so simple, but it's driving me crazy.
>
> I have a file that looks a bit like this:
>
>  -0.15     -0.15     -0.20
>  -0.20     -0.20     -0.15
>  -0.15     -0.15     -0.15
>
>
>          0.002
>                    0.007
>                              0.038
>
> But I'd like it to be:
>
> -0.15     -0.15     -0.20
>  -0.20     -0.20     -0.15
>  -0.15     -0.15     -0.15
>  0.002    0.007     0.038
>
> (Empty lines between lines are ok. ) I guess I'm supposed to get rid
> of a newline if the next line starts with whitespace, but my regexps
> just aren't doing it. (Or get rid of a newline if it's followed by
> whitespace?)
>
> Any thoughts?
> Thanks very much!
>

So, what regexps have you tried?  How did they not get the job done?  What
did they do you didn't expect them to do, or vice-versa?

Paul Lalli


------------------------------

Date: Fri, 05 Mar 2004 13:30:06 -0600
From: Jason Godfrey <jg2002@aptsolutions.com>
Subject: Re: waitpid interrupted problem
Message-Id: <4048D53E.89F28170@aptsolutions.com>

Hello.

Sorry for the delay, I wanted to try on a different box before replying.

Ben Morrow wrote:

>
> notably, mine uses fork(2) instead of clone2(2) and alarm(2) instead of
> setitimer(2). What are your linux/glibc/perl versions? I have
>
> linux 2.4.20-xfs_pre6 (with Gentoo patches)
> glibc 2.3.2
>     linuxthreads-0.10
> perl 5.8.2 for i686-linux-thread-multi
>     with mostly defaults taken for Configure (in particular, perl
>     *doesn't* use vfork)
>

glibc-2.3.2-95.6
perl-5.8.0-88.4
linux  2.4.21-9.EL #1 SMP

The machine has NPTL backported to 2.4 kernel.

In any event, I think I can code around this behaivor. I just wanted to see
if this was a general perl problem.  It looks like it is configuration
specific.

Thanks
- Jason

>
> Ben
>
> --
> And if you wanna make sense / Whatcha looking at me for?          (Fiona Apple)
>                             * ben@morrow.me.uk *

--
---------------------------------------------------------
Jason Godfrey                             godfrey@sgi.com
Engineering Software & Diagnostics         Vnet: 233-3432
Online Diagnostics                         (651) 683-3432





------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 6224
***************************************


home help back first fref pref prev next nref lref last post