[25166] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 7415 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 17 18:05:41 2004

Date: Wed, 17 Nov 2004 15:05:07 -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           Wed, 17 Nov 2004     Volume: 10 Number: 7415

Today's topics:
    Re: Adding a unique user name in a file <joe@inwap.com>
    Re: Array of Hashes ? <mritty@gmail.com>
    Re: Array of Hashes ? <ThomasKratz@REMOVEwebCAPS.de>
    Re: CPAN shell as plain user <richard@zync.co.uk>
    Re: CPAN shell as plain user <perl@my-header.org>
        FAQ 5.25: How do I print to more than one file at once? <comdog@panix.com>
        Hash of hash in perl <shashank@mia.ece.uic.edu>
    Re: Hash of hash in perl <bigj@kamelfreund.de>
    Re: Managing PERL5LIB with multiple perl installation <usenet@morrow.me.uk>
        Outputs stop ignoring SIGINT with Event.pm <xxxxxxx@xxx.xxx>
    Re: Parse Row to Columns <usenet@morrow.me.uk>
    Re: perldoc problem on linux (Zhiliang Hu)
    Re: perldoc problem on linux <joe@inwap.com>
    Re: RegEx challenge - found - thanks <google@servangle.net>
    Re: RegEx challenge - found <google@servangle.net>
    Re: RegEx challenge - still looking <google@servangle.net>
    Re: RegEx challenge - still looking <1usa@llenroc.ude.invalid>
    Re: RegEx challenge - still looking <google@servangle.net>
    Re: Save excel including embedded Formulas, Comments et <usenet@morrow.me.uk>
    Re: Server side redirection <joe@inwap.com>
    Re: spam assassin - running <richard@zync.co.uk>
    Re: SysV constants, where are they defined? <jgibson@mail.arc.nasa.gov>
    Re: Text::Autoformat usage for a rookie <usenet@morrow.me.uk>
    Re: the antichomp <bigj@kamelfreund.de>
    Re: the antichomp <1usa@llenroc.ude.invalid>
    Re: the antichomp <joe@inwap.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 17 Nov 2004 21:35:30 GMT
From: Joe Smith <joe@inwap.com>
Subject: Re: Adding a unique user name in a file
Message-Id: <CuPmd.418792$D%.94370@attbi_s51>

sam wrote:
> Is there any perl module I can use to read in a list of user names from 
> a file and do a binary search on the list base on the user name, if the 
> user name is not found, add this user name to the file?

Why do a binary search?  You can accomplish the same thing by
tying a hash to a file.  Then use ordinary hash operations to test
for the existance of a given key.  Or use
   $file_based_hash_of_names{$username} = 1;
unconditionally to add it to the list.

	-Joe


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

Date: Wed, 17 Nov 2004 19:10:10 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Array of Hashes ?
Message-Id: <mmNmd.12280$tI3.2385@trndny01>

"Tom" <sudhirx@gmail.com> wrote in message
news:f50c52fa.0411170859.ed4643f@posting.google.com...
> Well, I am a beginner as far as perl is concerned.
> Can some one point me that 'm doing is correct.
> I have pasted below my hash and array using Data::Dumper()
>
> I am pushing Hash1, Hash2 in to an Array
> I don't see => when 'm priting the Array using Data::Dumper()

I really don't understand what any of this means.

> By looking at the dump can someone ascertain if I have formed an Array
> of Hashes or not?

Afraid not.  See below.

>
> Tom> Hash 1:
> $VAR1 = {
>           '1' => [
>                    '0'
>                  ],
>           '0' => [
>                    '0'
>                  ],
>           'TestCase' => [
>                           'PC_Battery'
>                         ]
>         };


Here, $VAR1 is a reference to a hash with three key/value pairs.  The
keys are '0', '1', and 'TestCase'.  Each value of the hash in a
reference to an array that contains one element each.

> Tom> Hash 2:
> $VAR1 = {
>           '1' => [
>                    '0'
>                  ],
>           '0' => [
>                    '0'
>                  ],
>           '2' => [
>                    '0'
>                  ],
>           'TestCase' => [
>                           'PC_Something'
>                         ]
>         };
>

Same exact thing, but with an extra key/value pair in the hash.

> Tom> Array of Hashes: (?)
> $VAR1 = [
>           [
>             '1',
>             [
>               '0'
>             ],
>             '0',
>             [
>               '0'
>             ],
>             'TestCase',
>             [
>               'PC_Battery'
>             ]
>           ],


There is no hash in here anywhere.  You have an array of array
references.  The first element in the overall array is an array
reference.  That array contains the values: 1, (a reference to an array
containing 0), 0, (a reference to another array containing 0),
'TestCase', and (a reference to an array containing 'PC_Battery')

At this point, it would be helpful to see your code so we can help you
see where you went wrong in creating an array where you thought you were
creating a hash.

Paul Lalli



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

Date: Wed, 17 Nov 2004 20:41:26 +0100
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: Array of Hashes ?
Message-Id: <419ba967$0$17093$bb690d87@news.main-rheiner.de>

Tom wrote:
> Well, I am a beginner as far as perl is concerned.
> Can some one point me that 'm doing is correct.
> I have pasted below my hash and array using Data::Dumper()
> 
> I am pushing Hash1, Hash2 in to an Array

No. The data you posted shows that you pushed two anonymous arrays 
containing the flattened hashes into the array.

I assume you did:

    push @Array, [%Hash1];
    push @Array, [%Hash2];

Try to push *references* to Hash1 and Hash2  to the Array like so:

    push @Array, \%Hash1;
    push @Array, \%Hash2;

See perldoc perlreftut

Next time post real code.
And please have a look at the posting guidelines.

Thomas

-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

Date: Wed, 17 Nov 2004 19:20:16 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: CPAN shell as plain user
Message-Id: <pan.2004.11.17.19.20.16.230242@zync.co.uk>

On Wed, 17 Nov 2004 18:29:15 +0100, Matija Papec wrote:

> 
> I want to install some modules and everything goes well until "make install"
> as there are some test errors. Should I "force install Net::SFTP"?
> 
> 
> o conf makepl_arg "LIB=~/myperl/lib INSTALLMAN1DIR=~/myperl/man/man1
> INSTALLMAN3DIR=~/myperl/man/man3"
> 
> install Net::SFTP
> 
> ================
>         Test returned status 2 (wstat 512, 0x200)
> Failed Test     Stat Wstat Total Fail  Failed  List of Failed
> ----------------------------------------------------------------------
> t/01-load.t        2   512     1    2 200.00%  1
> t/06-circular.t    2   512    ??   ??       %  ??
> Failed 2/2 test scripts, 0.00% okay. 1/1 subtests failed, 0.00% okay.
> make: *** [test_dynamic] Error 2
>   /usr/bin/make test -- NOT OK
> Running make install
>   make test had returned bad status, won't install without force
> 
> cpan>

My guess is that the test suite is trying to listen on a privileged port
(< 1024) which can only be opened by root, which you are not (a 2nd
guess, based on your makepl_arg setting) so the test fails. If these are
correct guesses, and nothing else is wrong, then you will be OK with a
force install. It's probably worth a try. You could also edit the tests to
try and make it use a non-privileged port.

Rich


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

Date: Wed, 17 Nov 2004 22:45:20 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: CPAN shell as plain user
Message-Id: <4qgnp0lk4c8qfr5bg0rrvlftb7vr3nlvun@4ax.com>

X-Ftn-To: Richard Gration 

Richard Gration <richard@zync.co.uk> wrote:
>>   make test had returned bad status, won't install without force
>> 
>> cpan>
>
>My guess is that the test suite is trying to listen on a privileged port
>(< 1024) which can only be opened by root, which you are not (a 2nd
>guess, based on your makepl_arg setting) so the test fails. If these are
>correct guesses, and nothing else is wrong, then you will be OK with a
>force install. It's probably worth a try. You could also edit the tests to
>try and make it use a non-privileged port.

Tnx, I found later that tests didn't finish because they were unable to find
some of the modules (through @INC). I'm sure that makepl_arg is fine and did
"o commit" with them. Is it possible that tests are written only to function
properly with root user in mind? Anyway, I did forcing and everything is in
place now and working. :)



-- 
Matija


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

Date: Wed, 17 Nov 2004 23:03:02 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 5.25: How do I print to more than one file at once?
Message-Id: <cnglb6$113$1@reader1.panix.com>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.

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

5.25: How do I print to more than one file at once?

    To connect one filehandle to several output filehandles, you can use the
    IO::Tee or Tie::FileHandle::Multiplex modules.

    If you only have to do this once, you can print individually to each
    filehandle.

        for $fh (FH1, FH2, FH3) { print $fh "whatever\n" }



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

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-2002 Tom Christiansen and Nathan
    Torkington, and other contributors as noted. All rights 
    reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.


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

Date: Wed, 17 Nov 2004 16:08:07 -0600
From: Shashank Khanvilkar <shashank@mia.ece.uic.edu>
Subject: Hash of hash in perl
Message-Id: <cngjth$7h1$1@newsx.cc.uic.edu>

Hi,
Any help is appreciated.
I have data in the following format

A
   B=2
   C=3
B
   S=2
   T=10
 ...


I need to populate a hash data structure (%graph) in perl so that %graph 
will have the form
%graph = ( 

	A => {B=>2,C=>3}, 

	B => {S=>2,T=>10}
}

Assume that I have a program that has read A in $A, B in $B and so on 
and the integers in $int. Can I Do the following:

%graph{$A}{$B} = $int

to populate the above hash of the hash.
Thanks
Shashank


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

Date: Wed, 17 Nov 2004 23:20:46 +0100
From: Janek Schleicher <bigj@kamelfreund.de>
Subject: Re: Hash of hash in perl
Message-Id: <pan.2004.11.17.22.20.39.80191@kamelfreund.de>

On Wed, 17 Nov 2004 16:08:07 -0600, Shashank Khanvilkar wrote:

> I have data in the following format
> 
> A
>    B=2
>    C=3
> B
>    S=2
>    T=10
> ...
> 
> 
> I need to populate a hash data structure (%graph) in perl so that %graph 
> will have the form
> %graph = ( 
> 
> 	A => {B=>2,C=>3}, 
> 
> 	B => {S=>2,T=>10}
> }

What have you tried so far? It's hard to spot where's your problem without
to know something about.

However the following snippet seems to do what you want:

#!/usr/bin/perl
use strict;
use warnings;

my %graph;
my $sec;

while (<DATA>) {
    chomp;
       /^(\w+)/      and $sec = $1
    or /(\w+)=(\d+)/ and $graph{$sec}->{$1} = $2; 
}

use Data::Dumper;
print Dumper(\%graph);

__DATA__
A
   B=2
   C=3
B
   S=2
   T=10


Greetings,
Janek


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

Date: Wed, 17 Nov 2004 17:45:10 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Managing PERL5LIB with multiple perl installation
Message-Id: <6afs62-di5.ln1@osiris.mauzo.dyndns.org>


Quoth $HOME:
> The default global installation of perl here is 5.005_03
> 
> I have installed v5.8.4 locally as a higher version was needed for some
> of the modules i am using.
> 
> Now I need to constantly switch the value of PERL5LIB enviornment
> variable depending on wether I am using my local scripts or scripts
> developed by others . Is there a way to automate this without changing
> my perl scripts?

Write a module which checks $] and sets @INC to the approriate thing[1],
and put e.g. -MLocal::MyINC in PERL5OPT.

[1] use lib rather than explicitly setting @INC, as it deals with
finding the right arch-specific directory as well.

Ben

-- 
           All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk                                                  Kurt Vonnegut


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

Date: Wed, 17 Nov 2004 16:21:41 -0500
From: "Brad" <xxxxxxx@xxx.xxx>
Subject: Outputs stop ignoring SIGINT with Event.pm
Message-Id: <DhPmd.706$wa1.109@lakeread04>

Vital stats:
    Perl Version:            5.6.1
    Event.pm version:    0.85
    OS:                           Solaris 8 (Sparc)

I have a perl script that runs 24/7.  It uses Event.pm to control various
processes and commands.  To command it, I telnet into a particular port that
it listening on.  If during the session I type a ^C the process would
terminate.  I have attempted to ignore the ^C by two different methods:

    1.  $SIG{INT} = "IGNORE";
    2. Event->signal(signal => 'INT', cb => sub{});

In both cases, output to the telnet process stops, but the perl scripts still
responds to commands on the port.  If I break the connection and restablish
all is fine.

So, what do I have to do to reestablish output?

Thanx.

Brad





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

Date: Wed, 17 Nov 2004 17:57:50 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Parse Row to Columns
Message-Id: <u1gs62-di5.ln1@osiris.mauzo.dyndns.org>


Quoth "Buck Turgidson" <jc_va@hotmail.com>:
> I have a very large csv file from a spreadsheet.  The first 2 columns are a
> description, and the next 52 columns are a value for a week of the year
> (using only 3 weeks in this example)
> 
> Is there a way in Perl to transform these into a format that is loadable
> into a relational database such as Oracle?
> 
> For example, I'd like to change the following into the latter format.  The
> first column would be a derived week number.  That first column is something
> I could live without if I had to.

For each line of the file

    Split off the first two columns and keep them.
    
    For each of the remaining columns
    
        Calculate the week number, perhaps using one of the date/time
        modules from CPAN, of which there are many.

        Write out a line with the calculated number, the two columns
        you've saved, and the column you're working with.

Now translate this into Perl. If you get stuck, post what you've got
here and we'll help you.

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


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

Date: 17 Nov 2004 11:10:27 -0800
From: zhilianghu@yahoo.com (Zhiliang Hu)
Subject: Re: perldoc problem on linux
Message-Id: <1daf0582.0411171110.3934599@posting.google.com>

All those 3 works:

 perldoc -t GD | less
 perldoc -t GD | more
 perldoc -t GD | nroff

but not this one (seen as I described earlier):

 perldoc -t GD

I wonder which file/folder I should look at to "check permissions" as
Anno suggested? (I found all perl related man pages are in
/usr/share/man/man1 or man3, to which permissions are allowed for all
users, i.e. 755 or 644 for folders or files respectively).

Zhiliang


anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<cn065m$f3q$1@mamenchi.zrz.TU-Berlin.DE>...
> James Willmore  <jwillmore@fastmail.us> wrote in comp.lang.perl.misc:
> > On Thu, 11 Nov 2004 12:44:27 +0000, Anno Siegel wrote:
> > 
> > > James Willmore  <jwillmore@fastmail.us> wrote in comp.lang.perl.misc:
> > >> On Wed, 10 Nov 2004 13:30:34 -0800, Zhiliang Hu wrote:
> > >> 
> > >> <snip>
> > >> > Yes, I did - 'perldoc' is in /usr/local/bin/ and it is in both my and
> > >> > ~root's path.  (I double checked them and I still got the same as
> > >> > before).
> > >> > 
> > >> > Following commands work fine:
> > >> >  > perloc -V
> > >> >  > perldoc -h
> > >> >  > perldoc NONEexist    (this returns "No documentation found")
> > >> >  > perldoc -l WWW::Search
> > >> > 
> > >> > but "perldoc WWW::Search" will show nothing but login prompts.
> > >> 
> > >> As a "quick fix", you could (since you're on a *nix box) try:
> > >> perldoc -t WWW::Search | less
> > >> 
> > >> If this works, then you can at least use perldoc until you hunt down the
> > >> cause of the problem.
> > > 
> > > What makes you think "perldoc -t" would work?  My guess is it's a
> > > permission problem that doesn't exist for root.
> > 
> > I took it the poster at his word that the only thing he couldn't do was
> > view the documentation.  I was under the impression that if you try to run
> > perldoc as root, then it would always issue an error message about it
> > being unsafe to run as root - regardless of what option.  The error
> > mentioned in the OP was he tried to run perldoc to view documentation and
> > got nothing.
> 
> I see.  However, OP said it works for him(?) as root, but not as an
> ordinary user.  In such a case, I tend to check permissions first.
> 
> Otherwise I believe perldoc is root-safe now and the warning is gone.
> (Yup, v3.13 is fine with root)
> 
> In any case, someone (Sean Burke, to give credit where credit is due)
> has done a tremendous job of cleaning up the code.  Perldoc used to be
> a horror of a script -- I remember I tried to fix something minor once,
> but had to give up because I couldn't make sure in reasonable time
> that the fix wouldn't break something else.  When I looked at it last
> night I found a well-organized program, neatly divided up in modules.
> It would be a joy to fix if I knew of anything that needed fixing.
> 
> > I agree that it might be a permission problem ... OTOH, if it's working
> > for an unprivileged user, it might be the pager setting for root. Trying
> > to run perldoc with the -t option might (dis)prove this. Besides, as I
> > mentioned, this was a temporary fix ... what does it hurt to try it and
> > find it doesn't work. :-)
> 
> There's certainly nothing wrong with trying it, I was just curious
> what gave you the idea, given the symptoms.
> 
> Anno


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

Date: Wed, 17 Nov 2004 21:09:50 GMT
From: Joe Smith <joe@inwap.com>
Subject: Re: perldoc problem on linux
Message-Id: <y6Pmd.44265$V41.7881@attbi_s52>

Zhiliang Hu wrote:
> All those 3 works:
> 
>  perldoc -t GD | less
>  perldoc -t GD | more
>  perldoc -t GD | nroff
> 
> but not this one (seen as I described earlier):
> 
>  perldoc -t GD

That's because perldoc does something different when output goes
to a tty versus being piped to a program.
When being piped to a program, the text is sent to STDOUT as is.
When -t STDOUT is true, it checks the environment variables
PERLDOC_PAGER and PAGER (in that order) before trying 'more' or 'less'.

   echo "PAGER=$PAGER PERLDOC_PAGER=$PERLDOC_PAGER"
   ls -l $PAGER; ls -l $PERLDOC_PAGER

   setenv PAGER less		# csh, tcsh
   export PAGER=less		# bash
   perldoc perldoc


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

Date: Wed, 17 Nov 2004 10:23:42 -1000
From: "John R." <google@servangle.net>
Subject: Re: RegEx challenge - found - thanks
Message-Id: <419bb15e$1_4@127.0.0.1>

gnari wrote:
> don't be so arrogant when you are asking for help.
> 
> maybe you want something like: /(\w+):("[^"]+"|[^;]+);\s?/m
> but in any case read the faq entry you have been referred to.
> 
> gnari
> 

gnari, your expression worked the best with slight tweaking:

Expression:
(\w+):?("[^"]+"|[^;]+)?;\s?

Target String:
blah:54;alone;blah:tree;blah:"trt;hgd";blah:hhh;

Split String:
|blah|54||alone|||blah|tree||blah|"trt;hgd"||blah|hhh


The above has been copied out of "The Regex Coach" tool. I learned alot 
here on how important a good "or" is.
Mahalo,

-John R.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Wed, 17 Nov 2004 10:02:21 -1000
From: "John R." <google@servangle.net>
Subject: Re: RegEx challenge - found
Message-Id: <419bac5d$1_3@127.0.0.1>

A. Sinan Unur wrote:
 >
 > This is the exact same FAQ entry I directed you to in my first response.
 >
 > ...

Yes, you are correct. My apologies. I was looking at an online FAQ at 
perldoc.com, and  couldn't find it. So I went back to the command prompt 
and searched the perldoc directly and found it! Something I should have 
done from the start. Thanks for the help.

 >
 >>Again, regex is used an a lot of langs, so I'm just after the
 >>expression itself.
 >
 >
 > Do you have a Perl question or not?

No I don't, but since there is no "comp.lang.regex" news group I thought 
it best to ask the question here. See, I knew you perl guys would know 
the answer. Thanks again all.

-John R.

 >
 > Feel free to study the source code of the modules mentioned in the FAQ
 > answer to see how it is done.
 >
 > Sinan.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Wed, 17 Nov 2004 09:37:38 -1000
From: "John R." <google@servangle.net>
Subject: Re: RegEx challenge - still looking
Message-Id: <419ba692$1_1@127.0.0.1>

Tad McClellan wrote:
> It sounds just like this question:
> 
>        How can I split a [character] delimited string except when inside
>        [character]? (Comma-separated files)
> 
> Do you understand the answer given along with it?
> 

Yes, this is much closer to my question. Using regex, how does one split 
on semi-colins (;) except when inclosed by quotes (")? Example:


somthing;blah;blahblah;"dont;split";blah4;andmoreblahs

should be split into:

something
blah
blahblah
"dont;split"
blah4
andmoreblahs


Again, regex is used an a lot of langs, so I'm just after the expression 
itself.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: 17 Nov 2004 19:45:39 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: RegEx challenge - still looking
Message-Id: <Xns95A496281F1B3asu1cornelledu@132.236.56.8>

"John R." <google@servangle.net> wrote in news:419ba692$1_1@127.0.0.1:

> Tad McClellan wrote:
>> It sounds just like this question:
>> 
>>        How can I split a [character] delimited string except when
>>        inside [character]? (Comma-separated files)
>> 
>> Do you understand the answer given along with it?
>> 
> 
> Yes, this is much closer to my question. 

This is the exact same FAQ entry I directed you to in my first response.

 ...

> Again, regex is used an a lot of langs, so I'm just after the
> expression itself.

Do you have a Perl question or not?

Feel free to study the source code of the modules mentioned in the FAQ 
answer to see how it is done.

Sinan.


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

Date: Wed, 17 Nov 2004 10:01:28 -1000
From: "John R." <google@servangle.net>
Subject: Re: RegEx challenge - still looking
Message-Id: <419bac29$1_3@127.0.0.1>

A. Sinan Unur wrote:
 >
 > This is the exact same FAQ entry I directed you to in my first response.
 >
 > ...

Yes, you are correct. My apologies. I was looking at an online FAQ at 
perldoc.com, and  couldn't find it. So I went back to the command prompt 
and searched the perldoc directly and found it! Something I should have 
done from the start. Thanks for the help.

 >
 >>Again, regex is used an a lot of langs, so I'm just after the
 >>expression itself.
 >
 >
 > Do you have a Perl question or not?

No I don't, but since there is no "comp.lang.regex" news group I thought 
it best to ask the question here. See, I knew you perl guys would know 
the answer. Thanks again all.

-John R.

 >
 > Feel free to study the source code of the modules mentioned in the FAQ
 > answer to see how it is done.
 >
 > Sinan.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---


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

Date: Wed, 17 Nov 2004 17:46:36 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Save excel including embedded Formulas, Comments etc.
Message-Id: <scfs62-di5.ln1@osiris.mauzo.dyndns.org>


Quoth qazmlp1209@rediffmail.com (qazmlp):
> Using Perl, is it possible to copy an excel into another excel with
> all the Formulas, Comments etc. that are embedded as part of it?

There are modules for reading/writing Excel documents on CPAN; or you
could try Win32::OLE.

Ben

-- 
  Joy and Woe are woven fine,
  A Clothing for the Soul divine       William Blake
  Under every grief and pine          'Auguries of Innocence'
  Runs a joy with silken twine.                                ben@morrow.me.uk


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

Date: Wed, 17 Nov 2004 21:42:05 GMT
From: Joe Smith <joe@inwap.com>
Subject: Re: Server side redirection
Message-Id: <NAPmd.44361$V41.3604@attbi_s52>

brijesh wrote:

> I want to perform server side redirection.

You want the server to send something to the browser to cause
the browser to go to a different URL, right?

> I know "print redirect($url)" method.. But i dont want that

Unless there is more to the task than what you've posted,
that method or (its equivalent) is what you have to use.

Having one CGI post-process another CGI's output is a different topic.
	-Joe


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

Date: Wed, 17 Nov 2004 19:11:22 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: spam assassin - running
Message-Id: <pan.2004.11.17.19.11.22.509703@zync.co.uk>

On Wed, 17 Nov 2004 11:57:04 +0000, lukes wrote:

> hello,
Hello :-)
> my $mail = Mail::SpamAssassin::NoMailAudit->new( %parameters );   # it
<SNIP>
> Takes a hash reference as a parameter.

You are not passing a hash reference, you are passing a hash. You want:

my $mail = Mail::SpamAssassin::NoMailAudit->new( \%parameters );
                                                 ^

HTH
Rich


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

Date: Wed, 17 Nov 2004 12:20:16 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: SysV constants, where are they defined?
Message-Id: <171120041220165891%jgibson@mail.arc.nasa.gov>

In article <51d6249f.0411170916.55373844@posting.google.com>, js
<jstrempe@cox.net> wrote:

> I'm getting into some programming with IPC::Semaphore, etc.  After
> spending some time searching without success, I was wondering where
> one finds what each of the SysV constants stand for so I know a little
> bit more of what I'm doing.

On my system the values are defined in /usr/include/sys/sem.h

If you want to know what the values mean, you should be looking for
references on System V. The best reference I have seen is "Advanced
Programming in the UNIX Environment", by W. Richard Stevens. I
understand there is a new edition of this book out with some
co-authors. You absolutely need a copy of this book if you are going to
do any serious unix systems programming.


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

Date: Wed, 17 Nov 2004 17:54:29 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Text::Autoformat usage for a rookie
Message-Id: <lrfs62-di5.ln1@osiris.mauzo.dyndns.org>


Quoth gary_schenk@yahoo.com (Gary Schenk):
> Ben Morrow <usenet@morrow.me.uk> wrote in message news:<qf0p62-715.ln1@osiris.mauzo.dyndns.org>...
> > Quoth Gary Schenk <gwschenk@fuzz.socal.rr.com>:
> 
> > >    open( OUTPUT, ">output.txt" ) or die( "Can't open output.txt:
> > > $!" );
> > 
> > This is generally a bad idea... you would be much better off (say)
> > renaming the old file to "$input~" and overwriting, or creating the new
> > file as "$input.fmt"; or simply processing STDIN to STDOUT and letting
> > the user redirect where he will.
> 
> I have a need to keep the original file intact. However, that is
> laziness on my part. ( A Perl virtue?) Why is this "generally a bad
> idea"?

Sorry, I was unclear... hardcoding an output filename is generally a bad
idea. It makes the program more confusing to use, and (for instance)
will clobber the old output if you run it twice.

Keeping the old file intact is fine; my recommendations, expressed a
little more verbosely, were:

1. rename the original file to "$input~", and write the new data to a
new file $input. This will leave the unformatted text in "$input~" and
the formatted data under the original filename. My choice of '~' is
standard on Unix systems; if you are on Win32 you may prefer '.bak'; if
elsewhere something else.

2. Choose soome suffix such as '.fmt' and append it to the input
filename to get the file to write the output to. This will leave the
input data where it was and put the output somewhere you can find it.

3. Process from STDIN to STDOUT. This means the program is invoked as

myfmt < input > output

and you can put the output where you like.

Ben

-- 
  Joy and Woe are woven fine,
  A Clothing for the Soul divine       William Blake
  Under every grief and pine          'Auguries of Innocence'
  Runs a joy with silken twine.                                ben@morrow.me.uk


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

Date: Wed, 17 Nov 2004 20:10:40 +0100
From: Janek Schleicher <bigj@kamelfreund.de>
Subject: Re: the antichomp
Message-Id: <pan.2004.11.17.19.10.31.985878@kamelfreund.de>

On Wed, 17 Nov 2004 07:15:55 -0800, wana wrote:

> Is there a better way to it than this?
> 
> $_ .= "\n" for @ARGV;

Well a bit shorter and perhaps more in a sense of antichomp might be
  $_ .= $/ for @ARGV;

However, that fails to do something sensful if $/ contains e.g. a
reference to a number, but whenever $/ contains a simple line ending
string, that antichomp variation would add what chomp would have removed
perhaps before.


Greetings,
Janek


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

Date: 17 Nov 2004 19:32:31 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: the antichomp
Message-Id: <Xns95A493EDD2914asu1cornelledu@132.236.56.8>

Uri Guttman <uguttman@athenahealth.com> wrote in 
news:m38y9071n5.fsf@lap.athenahealth.com:

>>>>>> "ASU" == A Sinan Unur <1usa@llenroc.ude.invalid> writes:
> 
>   ASU> Uri Guttman <uri@stemsystems.com> wrote in 
>   ASU> news:x7is845vlh.fsf@mail.sysarch.com:
> 
>  >>>>>>> "w" == wana  <ioneabu@yahoo.com> writes:
>  >> 
>   w> Is there a better way to it than this?
>   w> $_ .= "\n" for @ARGV;
>  >> 
>  >> s/for/x/ ;
>  >> 
>  >> uri
> 
>   ASU> I am confused. 
> 
> untested as always. must have been too late at night. i didn't see the
> $_ being aliased to the elements of @ARGV.

It's OK. I was beginning to think I was missing something extremely 
fundamental :)

Sinan.


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

Date: Wed, 17 Nov 2004 21:31:46 GMT
From: Joe Smith <joe@inwap.com>
Subject: Re: the antichomp
Message-Id: <6rPmd.623842$8_6.462880@attbi_s04>

A. Sinan Unur wrote:

>>Is there a better way to it than this?
>>
>>$_ .= "\n" for @ARGV;
> 
> 
> Of course. Read perldoc -f chomp.

That's a rather cryptic way of saying that

   $_ .= $/ for @ARGV;

is better.  I would add logic to not append $/
if the string already has the end-of-line character(s).

   @array1 = ("line1", "linefeed already present on second\n", "line3");

   @array = @array1;
   $_ .= "\n" for @array;
   print 'A: ',@array;

   @array = @array1;
   $_ .= (m{$/$} ? '' : $/) for @array;
   print 'B: ',@array;

That's assuming that the "total number of characters added" is
not needed.
	-Joe



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

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


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