[22477] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4698 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 12 06:05:54 2003

Date: Wed, 12 Mar 2003 03: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           Wed, 12 Mar 2003     Volume: 10 Number: 4698

Today's topics:
    Re: binary template for OMF? <josef.moellers@fujitsu-siemens.com>
        CPAN.pm: version of installed module not updated? <spamfilter@cheiron-it.nl>
    Re: dbm lock problem (found!) <ixanthi@ixanthi.remove.gr>
        glob causes perl.exe to crash <jvandervloet@hotmail.com>
    Re: glob causes perl.exe to crash <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: glob causes perl.exe to crash <jvandervloet@hotmail.com>
    Re: glob causes perl.exe to crash <bernard.el-hagin@DODGE_THISlido-tech.net>
        Insert End-of-line <bobkardell@yahoo.com>
    Re: Insert End-of-line <goldbb2@earthlink.net>
    Re: Merging log files using hash - good idea/possible? news@roaima.freeserve.co.uk
    Re: my $x = 100 for 1..3  why is $x undef <mgjv@tradingpost.com.au>
    Re: my $x = 100 for 1..3  why is $x undef <abigail@abigail.nl>
    Re: Need Help : Passing Parameters to Functions <tassilo.parseval@post.rwth-aachen.de>
        newbie seeks references <elainejackson7355@home.com>
    Re: newbie seeks references <tassilo.parseval@post.rwth-aachen.de>
    Re: Object Oriente with Perl. <mgjv@tradingpost.com.au>
        perl-ldap problem (Alessandro Favretto)
    Re: perl-ldap problem <josef.moellers@fujitsu-siemens.com>
    Re: remove anything from string except two words (Pynex)
    Re: remove anything from string except two words <noreply@gunnar.cc>
        search script (Marco)
    Re: select ip-adress out of pipe delimited file (Pynex)
    Re: Using filehandles with compare <Steffen.Beyer@de.bosch.com>
    Re: XS, SWIG? Accessing C API easily <tassilo.parseval@post.rwth-aachen.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 12 Mar 2003 10:22:18 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: binary template for OMF?
Message-Id: <3E6EFC4A.1E7EE3F5@fujitsu-siemens.com>

Lars Unrotin wrote:

> this?  Is there a script for detecting how a binary file is laid out?

Simply speaking: no.

A binary file can have any layout: from a compressed, encrypted raw
binary dump of the data to a dump of the program's data space (some say
DOC files are just that) to a wonderfully structured, tagged file like
TIF, JPEG (tagged until the image starts B-{) or Cakewalk's WRK file.

The NSA might have nifty tools for this, but, as I said before: the best
tool for this sits right between your ears. I always work in a
combination of analysis and synthesis: I try to figure out what some
data item does, then manipulate it and see how the program reacts to
this.

Josef
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: Wed, 12 Mar 2003 10:44:16 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: CPAN.pm: version of installed module not updated?
Message-Id: <3e6f03f3$0$2229$e4fe514c@dreader6.news.xs4all.nl>

Hi,

I try to keep up with new versions of installed modules by using the 'r'
function in the CPAN shell. However, it seems that this list cannot be
trusted. The list tells me (for instance) that I have GD::Polyline version
0.1 and 0.2 is available. So I 'install GD::Polyline'. Firstly it looks
as if it does not get installed, but after a manual 'make install' it
does. 'r' is still showing '0.1' as active version though.

Now I suspect it's something in the module install script, but it happens
a lot (Pod::Parser, XML::LibXML::Iterator, even Net::Cmd). Any ideas about
this?

While at the subject: is there a simple 'update' command/module/whatever?
So that in stead of 'while ('r'->list) { install 'r'->list->first; }' by
hand it is somewhat automated (eg. RedHat's up2date)?

Thanks for any help.

--Frank




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

Date: Wed, 12 Mar 2003 08:19:41 +0200
From: "Vassilis Tavoultsidis" <ixanthi@ixanthi.remove.gr>
Subject: Re: dbm lock problem (found!)
Message-Id: <b4mji1$61l$1@nic.grnet.gr>

Thanks everybody but I found the problem yesterday. When you use DB_File you
have to specify the hole filename i.e. .../database/news.db while when you
use the dbmopen and dbmclose procedures you must not specify the extention
i.e. .../database/news (both refer to the same file). I changed the code I
already had to add a ".db" at the end of the filename and everything worked
fine.

Vassilis G. Tavoultsidis.

"Vassilis Tavoultsidis" <ixanthi@ixan-remove this-hi.gr> wrote in message
news:b4kkqi$amm$1@nic.grnet.gr...
> I am trying to lock a dbm file using the following code
>
> #!/usr/bin/perl
>
> use CGI;
> use Fcntl;
> use DB_File;
>
> my $q = new CGI;
>
>
> $dbfile = $q->param("dbfile");
>
> print "Content-type: text/html\n\n";
>
> print $dbfile."<br>";
>
> local *DBM;
> my $db = tie %dbdata, "DB_File", $dbfile, O_CREAT | O_RDWR, 0755 or print
> "could not tie to $dbfile: $!";
> my $fd = $db->fd;
> open DBM, "+<&=$fd" or print "Could not dub DBM for lock : $!";
> flock DBM, LOCK_EX;
> undef $db;
>
> while (($k, $v) = each(%dbdata))
> {
>   print $k."::".$v."<br>";
> };
> print "end.";
> untie %dbdata;
> exit;
>
> I am not taking an error messages but it seems that nothing is being
loaded
> !
> Should I use the dbmopen and dbmclose procedures everything works fine but
I
> have no locking capabilities
> Could anybody help me with that ?
> Thanks
>
> Vassilis Tavoultsidis
> ixanthi@ixanthi.gr
>
>




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

Date: Wed, 12 Mar 2003 09:29:25 GMT
From: "joeri" <jvandervloet@hotmail.com>
Subject: glob causes perl.exe to crash
Message-Id: <V5Dba.8304$Vq.854@afrodite.telenet-ops.be>

Hi,

I'm getting this weird crash problem caused by using glob.
Here's a little test script I wrote:

use File::Glob ':glob';
$v=2;
if ($v == 1){
@files=glob("*.txt");
}
else {
@files=glob("*.html");
}

If I try to run this using perl5.6.1 on a win 2k system, I get the following
error:

"The instruction at "0x01c21fc4" referenced memory at "0x00000000". The
memory could not be "read"."

Does anyone know what's going on here?

I bypassed the problem usinf readdir in the original program, but

I still would like to know what causes this error.

Thanks,

J




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

Date: Wed, 12 Mar 2003 09:34:09 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: glob causes perl.exe to crash
Message-Id: <Xns933C6AC644A53elhber1lidotechnet@62.89.127.66>

joeri wrote:

> Hi,
> 
> I'm getting this weird crash problem caused by using glob.
> Here's a little test script I wrote:
> 
> use File::Glob ':glob';
> $v=2;
> if ($v == 1){
> @files=glob("*.txt");
> }
> else {
> @files=glob("*.html");
> }
> 
> If I try to run this using perl5.6.1 on a win 2k system, I get the
> following error:
> 
> "The instruction at "0x01c21fc4" referenced memory at "0x00000000".
> The memory could not be "read"."
> 
> Does anyone know what's going on here?


No, but I had similar problems on Win 2k with Perl 5.6.1 so I upgraded 
Perl. Haven't had problems since.


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Wed, 12 Mar 2003 09:55:36 GMT
From: "joeri" <jvandervloet@hotmail.com>
Subject: Re: glob causes perl.exe to crash
Message-Id: <suDba.8326$Vq.762@afrodite.telenet-ops.be>


"Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
message news:Xns933C6AC644A53elhber1lidotechnet@62.89.127.66...

> No, but I had similar problems on Win 2k with Perl 5.6.1 so I upgraded
> Perl. Haven't had problems since.

I tried using perl5.8.0 and it gives the same problem...

J




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

Date: Wed, 12 Mar 2003 10:06:05 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: glob causes perl.exe to crash
Message-Id: <Xns933C7030C361Felhber1lidotechnet@62.89.127.66>

joeri wrote:

> 
> "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net> wrote in
> message news:Xns933C6AC644A53elhber1lidotechnet@62.89.127.66...
> 
>> No, but I had similar problems on Win 2k with Perl 5.6.1 so I upgraded
>> Perl. Haven't had problems since.
> 
> I tried using perl5.8.0 and it gives the same problem...


I just tested both versions of Perl. The 5.6.1 caused the error, 5.8.0 
didn't.


-- 
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'



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

Date: Tue, 11 Mar 2003 23:45:15 -0600
From: "Bob Kardell" <bobkardell@yahoo.com>
Subject: Insert End-of-line
Message-Id: <b4mhit$565$1@slb0.atl.mindspring.net>

I am working on trying to sort through a file like this:

thing1,thing2,: thing3,
thing4, thing5,:...

What I am looking to do is just match "thing2."  If a grep on  the file I
will get the entire line, so I did this:

while <FILE> {
    s/:/\n/g;
    @final = grep { s/thing2/ } $_;
}
print @final;

What I get though is the following:

thing1,thing2
thing3

Even though I have separated the items onto different lines, grep is still
looking at the entire original line, but now with a return character in it.

How do I get grep to search one line at a time?  Do I have to insert an
end-of-line character other than "\n"?  I don't want to simply split on
commas because I need the item preceeding the string I am searching for so I
don't want to get everything on its own line.  I could replace the ":" with
a unique string and define $\ as the unique string, but I thought there must
be a better/easier way of doing this.  I have been looking at this so long I
think I'm missing something.

Any help would be appreciated - thanks in advance,

Bob




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

Date: Wed, 12 Mar 2003 01:19:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Insert End-of-line
Message-Id: <3E6ED16E.1C1F1E30@earthlink.net>

Bob Kardell wrote:
> 
> I am working on trying to sort through a file like this:
> 
> thing1,thing2,: thing3,
> thing4, thing5,:...
> 
> What I am looking to do is just match "thing2."  If a grep on  the
> file I will get the entire line, so I did this:
> 
> while <FILE> {
>     s/:/\n/g;
>     @final = grep { s/thing2/ } $_;
> }
> print @final;

First, that's not real code, since it produces a syntax error.

Second, simply changing ":" chars to "\n" chars does not make $_ into an
array or list of things; it's still one thing, no matter how you munge
it's contents.

I think that you want:

   while(<FILE>) {
      chomp;
      print $_, "\n" for grep m/thing2/, split /:/;
   }

-- 
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}


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

Date: Wed, 12 Mar 2003 09:20:18 +0000
From: news@roaima.freeserve.co.uk
Subject: Re: Merging log files using hash - good idea/possible?
Message-Id: <i4um4b.36g.ln@moldev.cmagroup.co.uk>

dw <me@verizon.invalid> wrote:
> Assuming it is a log file and the entries in each file are in order, why not
> read one line from each file, print the line with the earlier date, read the
> next line from the file you just printed, repeat until EOF.

Ah. The classic "tape" merge  :-)

Chris
-- 
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}


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

Date: Wed, 12 Mar 2003 05:40:56 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: my $x = 100 for 1..3  why is $x undef
Message-Id: <slrnb6ti0b.79p.mgjv@verbruggen.comdyn.com.au>

On Wed, 12 Mar 2003 11:38:50 +0800,
	John Lin <jihghong@yahoo.com.tw> wrote:
> "Martien Verbruggen" wrote
>> John Lin wrote:
> 
>> > 1. It is not a bug of "use strict", because "my $x" is in the same
>> > scope as "print $x".
> 
>> No.
>> It is not a bug, because it is documented to result in undefined behaviour.
> 
> Now I understand.  Its hehaviour is undefined.  So we cannot say
> either "in the same scope", nor "in different scopes".  Because it
> is "undefined".

Indeed. And the current implementation seems to create something which
shouldn't even be able to exist. :)

Martien
-- 
                        | 
Martien Verbruggen      | Never hire a poor lawyer. Never buy from a
Trading Post Australia  | rich salesperson.
                        | 


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

Date: 12 Mar 2003 07:08:57 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: my $x = 100 for 1..3  why is $x undef
Message-Id: <slrnb6tn89.l3t.abigail@alexandra.abigail.nl>

Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMMCDLXXX September
MCMXCIII in <URL:news:slrnb6t9av.79p.mgjv@verbruggen.comdyn.com.au>:
##  
##  It is not a bug, because it is documented to result in undefined
##  behaviour.

I'm not quite sure I agree with that. 

When people started trying this construct ('my $foo = 1 if 0;'), 
people argued whether that was a feature or not. Only after p5p
couldn't decide what to do with it, they decided to at least
document it as having undefined behaviour.

Generally speaking, bugs don't go away just because you document them.



Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'


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

Date: 12 Mar 2003 06:06:30 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Need Help : Passing Parameters to Functions
Message-Id: <b4mip6$7eh$1@nets3.rz.RWTH-Aachen.DE>

Also sprach KP:
> In FirstSub $FileList is present but in the Second Sub it is not. This
> then returns a Error because it's not in the SecondSub. How would I
> pass $filelist to the SecondSub so that it can be used there as well.
> I have been reading up on Passing Parameters to Functions. But I'm
> just not getting it. Any help would be greatly appreciated.

The code you have shown simply consists of two subroutines and you do
not show how they are called. Passing parameters into functions needs
two steps: Calling it with the parameters and having code in the
function to handle the arguments.

    sub function {
        my @args = @_;
        # a copy of the passed arguments is now in @args
        print "You gave me: @args\n";
    }

    function(1, 2, 3);
    __END__
    You gave me: 1 2 3

You should read 'perldoc perlsub' first and perhaps come back if you
still have questions. Likely you will have since perlsub.pod also covers
more advanced topics relating to subroutines.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Wed, 12 Mar 2003 06:04:09 GMT
From: "Elaine Jackson" <elainejackson7355@home.com>
Subject: newbie seeks references
Message-Id: <t5Aba.451113$Yo4.19525353@news1.calgary.shaw.ca>

SHORT VERSION:

How do I find out if Perl will do the job I have in mind? If I decide to learn
Perl, where should I start?

LONG VERSION:

I've got a little program that I think is cute and I'd like to make it
accessible on my webpage, which is at geocities. I was thinking I would learn
Java over the summer and do it as an applet, but then somebody suggested that
Perl might also be a way to go. Now, I've used Javascript a little, but only for
client-side scripts. So I guess what I'd like is an overview of what Perl can do
and how it works. By "how it works" I don't mean the language itself; what I
mean is: What sort of development tools do I need? Where do I get them? What
type of file(s) do I make with them? Where do these files go after they're made?
Stuff like that.




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

Date: 12 Mar 2003 06:44:25 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: newbie seeks references
Message-Id: <b4ml09$8cd$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Elaine Jackson:

> SHORT VERSION:
> 
> How do I find out if Perl will do the job I have in mind? If I decide to learn
> Perl, where should I start?

The most reliable way is learning a little bit of Perl, at least enough
to play around with it.

> LONG VERSION:
> 
> I've got a little program that I think is cute and I'd like to make it
> accessible on my webpage, which is at geocities. I was thinking I
> would learn Java over the summer and do it as an applet, but then
> somebody suggested that Perl might also be a way to go. Now, I've used
> Javascript a little, but only for client-side scripts. 

That's one of the major distinctions: Perl can't sensibly be used
client-side-wise. That's a practical consideration only. There are no
useful Perl-plugins for the major browser available.

Perl in an web-environment is usually used to run programs on the server
and generating HTML based on some calculations the program does. The
browser (client) wont even realize that there was Perl involved on the
other side.

> So I guess what I'd like is an overview of what Perl can do and how it
> works. By "how it works" I don't mean the language itself; what I mean
> is: What sort of development tools do I need? Where do I get them?
> What type of file(s) do I make with them? Where do these files go
> after they're made?

Perl, unlike Java or C, is an interpreted language. You create simple
text-files (just as you do in Java) but you simply feed it to perl and
the program gets run. That's it: There's no compilation involved.

Depending on your operating system, these text-files can behave as
though they were a compiled program:

    #! /usr/bin/perl -w
    print "Hello, World!\n";
    __END__

If the above three lines are in a file called "hello.pl", the file is
executable, perl is to be found in /usr/bin AND you have an operating
system that knows how to deal with she-bang lines (the first line in the
above code; any UNIXish operating system can deal with them), you simply
type "hello.pl" on the shell and the program is executed. Perl scripts
for the web work the exact same way.

So all you need is a text-editor (the more decent the better since that
will be your primary tool) and a Perl interpreter. You get the latter
for all major and not so major operating systems. For windows, you get a
very good distribution at http://www.activestate.com/. UNIXes and Linux
probably have it already installed.

One other thing that needs to be mentioned about Perl: The language Perl
has an infrastructure called CPAN, a central place where you can obtain
modules from (libraries that extend Perl's functionality). There are a
couple of thousands of such modules available and all of them aim at
making common tasks as easy as possible. With the right module, a
complex task can be reduced to a few lines of code. To get an idea see
http://search.cpan.org/ and search for some keywords you might be
interested in.

For now, you can see the documentation that comes with Perl (it's vast)
at http://www.perldoc.com/. Look for 'perlintro', it's a new manpage
that is bundled with the most recent Perl (5.8.0) and can be used as an
introduction. Once you have Perl installed, all this documentation is on
your local machine with several tools to read and search it.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Wed, 12 Mar 2003 05:46:21 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Object Oriente with Perl.
Message-Id: <slrnb6tidd.79p.mgjv@verbruggen.comdyn.com.au>

On Tue, 11 Mar 2003 16:48:03 -0600,
	Joe Creaney <mail@annuna.com> wrote:
> I have been reading a about Object oriented programming in C++.  Is perl 
> suitable or OO programming.

Yes, it is.

Read the documentation that comes with Perl.

$ perldoc perltoot
$ perldoc perlboot
$ perldoc perlbot

and some others, like perlsub and perlref

For much, much more on OO in Perl, see

Damian Conway
/Object Oriented Perl/
http://www.manning.com/Conway/index.html

>                              If so what is the real advante of OO 
> programming.

For Perl: The advantages are the same as for other languages. What
those are, you should probably find out somewhere else. The newsgroup
comp.programming springs to mind.

However, don't forget that there are also disadvantages to OO, and
that OO is definitely not a cure-all, and does not always map neatly
to problems to be solved.

Martien
-- 
                        | 
Martien Verbruggen      | 
Trading Post Australia  | In a world without fences, who needs Gates?
                        | 


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

Date: 12 Mar 2003 02:44:12 -0800
From: alessandro.favretto@fracarro.com (Alessandro Favretto)
Subject: perl-ldap problem
Message-Id: <8b4ef51a.0303120244.64402e89@posting.google.com>

Hello, 

this is my first application using perl-ldap module. I started with a
sample ldap search but i've got a problem. I would use a web
interface. The cgi code i find on the net is this:

#!/usr/bin/perl

use Net::LDAP qw(:all);

$ldap = new Net::LDAP('ldapserver.mydomain.com') or die "$@";
$ldap->bind( version => 3 );
@attrs = ['cn', 'sn' , 'mail'];
$mesg = $ldap->search ( base => "o=myldap.com",
                        filter => "cn=John Smith",
                        attrs => @attrs
                      ) or die ("Failed on search.$!");

foreach $entry ($mesg->all_entries->mail)
{
	   $entry->dump;
}

This script  work all right by shell script (it extract and display
cn,sn,mail),
but i would save the singles result (then cn,sn,mail in this case ) on
some variables, in this way i will able to generate web page.

thank to everybody 
Best regards
Ale


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

Date: Wed, 12 Mar 2003 12:01:05 +0100
From: Josef =?iso-8859-1?Q?M=F6llers?= <josef.moellers@fujitsu-siemens.com>
Subject: Re: perl-ldap problem
Message-Id: <3E6F1371.9F534665@fujitsu-siemens.com>

Alessandro Favretto wrote:

> foreach $entry ($mesg->all_entries->mail)
> {
>            $entry->dump;
> }
> =

> This script  work all right by shell script (it extract and display
> cn,sn,mail),
> but i would save the singles result (then cn,sn,mail in this case ) on
> some variables, in this way i will able to generate web page.

Have you tried the get_value method?

for($i =3D 0 ; $i < $mesg->count ; $i++) {
    my $entry =3D $mesg->entry($i);
    my $cn =3D $entry->get_value("cn");
    my $sn =3D $entry->get_value("sn");
    my $mail =3D $entry->get_value("mail");
}
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett


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

Date: 11 Mar 2003 23:38:13 -0800
From: pynex@gmx.de (Pynex)
Subject: Re: remove anything from string except two words
Message-Id: <d57585e5.0303112338.294bdf27@posting.google.com>

pynex@gmx.de (Pynex) wrote in message news:<d57585e5.0303102223.77b3a06d@posting.google.com>...
> > > ( $newstring = $oldstring ) =~ s/Version\s+\d+\.\d+\(\d+\)|XZ-\d+//g;
> > 
> > I think that does exactly the opposite of what the poster wants (but he 
> > mentioned "cut out", so I'm not quite sure). ;-)
> > 
> > / Gunnar
> 
> Yes.
> 
> I want the opposite.
> 
> $newstring="Version 5.6(17)  XZ-6666"
> 
> I'm sorry that i'm not able to say exactly what i want, but many
> thanks for your help.

So, again: i want to cut out everything, beside Version 5.6(17)and XZ-6666.

After "cutting" i want to have a string with "Version 5.6(17)" and "XZ-6666" in it.

Ideas ?


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

Date: Wed, 12 Mar 2003 09:44:59 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: remove anything from string except two words
Message-Id: <b4ms1c$225dt1$1@ID-184292.news.dfncis.de>

Pynex wrote:
>>>I think that does exactly the opposite of what the poster wants (but he 
>>>mentioned "cut out", so I'm not quite sure). ;-)
>>>
>>>/ Gunnar
>>
>>Yes.
>>
>>I want the opposite.
>>
>>$newstring="Version 5.6(17)  XZ-6666"
>>
>>I'm sorry that i'm not able to say exactly what i want, but many
>>thanks for your help.
> 
> So, again: i want to cut out everything, beside Version 5.6(17)and XZ-6666.
> 
> After "cutting" i want to have a string with "Version 5.6(17)" and "XZ-6666" in it.
> 
> Ideas ?

But.. I already posted a suggestion 'the other way around':

http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&selm=b4iafh%241snfja%241%40ID-184292.news.dfncis.de

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 12 Mar 2003 01:06:14 -0800
From: ver_for@yahoo.it (Marco)
Subject: search script
Message-Id: <da63f24c.0303120106.271a3042@posting.google.com>

Hi,
I am searching a perl/cgi script that can solve my problem.
I download some txt or html or even pdf files  from Internet and I
want to check if there are some keywords in it.
The keywords are in an excel or in a text file. There are more that
4.000.
I would like to check if the keywords are present in these files and
know which are these keywords.

Thanks for you help

Marco


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

Date: 11 Mar 2003 23:30:10 -0800
From: pynex@gmx.de (Pynex)
Subject: Re: select ip-adress out of pipe delimited file
Message-Id: <d57585e5.0303112330.427d855b@posting.google.com>

>Using a list slice, you can access the 6th element directly:
>
>    $six = ( split /[|]/, $line)[ 5];
>
>This would be the standard way of picking out a single field.


This works fine for me !

Many thanks to all for your help !


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

Date: Wed, 12 Mar 2003 10:52:03 +0100
From: "Steffen Beyer" <Steffen.Beyer@de.bosch.com>
Subject: Re: Using filehandles with compare
Message-Id: <b4n003$shh$1@ns2.fe.internet.bosch.com>

"Bob Walton" <bwalton@rochester.rr.com> wrote in message news:3E6E9501.3050008@rochester.rr.com...
> Try:
>    if ((compare(*FH1,*FH2) == 0)){
> 
> You should also note that compare may also return -1 in the event of an 
> error.  It would be good to also test for that.

You might also want to do a "binmode(FH1) or die; binmode(FH2) or die;"
after opening the filehandles and before calling "compare" - at least
if the module which implements compare doesn't.

HTH.
Steffen



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

Date: 12 Mar 2003 06:23:41 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: XS, SWIG? Accessing C API easily
Message-Id: <b4mjpd$7r9$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Martien Verbruggen:

>> ()  I'd hate to have to learn to write 40 separate interface declarations
>> ()  for 40  C functions that I need, only to find that I can't call most
>> ()  of these functions from Perl.
> 
> If there's only 40, I'd probably just let h2xs or swig do its job, and
> write a pure Perl wrapper to translate the C API calling conventions
> into something more palatable to the Perl programmer. This avoids you
> having to know much about the guts of perl (perlguts) or its C API
> (perlapi), although that never can hurt.

With "h2xs ... do its job" you are probably referring to its -x switch
that should in theory be able to generate the XSUBS for you based on a C
interface. I tried it once with a not so complex C header and C::Scan
(which is used for parsing the C code) bailed out quite horribly. Ever
since that I refrained from any attempts to have it done for me
automatically and instead wrote my own proper XSUBS which is guaranteed
to always work.

I heard that SWIG can do it and perhaps it even works. But I still think
that wrapping up a C library for Perl without knowing the innards of XS
is an illusion and will end in frustration and a butt-ugly interface
(as you already mentioned). 

>> You might want to consider Inline::C.
> 
> That's another possibility.

Oh, I think I have to study Inline::C once more or otherwise I'll never
understand why people think it's superiour and easier than XS.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

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.  

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


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