[7772] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1397 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 1 16:07:17 1997

Date: Mon, 1 Dec 97 13:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 1 Dec 1997     Volume: 8 Number: 1397

Today's topics:
     calling C libraries from Perl and calling Perl librarie <dave@digidem.com>
     Re: calling C libraries from Perl and calling Perl libr <jhi@alpha.hut.fi>
     Re: Conditional compilation? (Bart Lateur)
     Re: Conditional compilation? <rootbeer@teleport.com>
     Re: Conditional compilation? (Mike Stok)
     dumb(?) question about arrays ... <dblom@istar.ca>
     Re: each() does not work?! <rootbeer@teleport.com>
     gethostbyaddr on Win32 systems (Greg Keene)
     Re: getopts on NT? (Jeff Kehoe)
     Re: localtime() <rootbeer@teleport.com>
     Re: open and whitespace (Andrew M. Langmead)
     Re: Outputting 100 lines at a time from a search <rootbeer@teleport.com>
     Passing one subroutine with parameters into another sub <jlee@mdsi.bc.ca>
     Re: Passing one subroutine with parameters into another <jlee@mdsi.bc.ca>
     Re: Passing one subroutine with parameters into another <rets@meta3.com>
     Re: Passing one subroutine with parameters into another <rootbeer@teleport.com>
     Re: Passing one subroutine with parameters into another (Andrew M. Langmead)
     Re: Please help with form script <rootbeer@teleport.com>
     problem using eval with array of file test operators <ceh@sunspot.sce.carleton.ca>
     Re: problem using eval with array of file test operator <rootbeer@teleport.com>
     Random numbers, perl and win95 :( (Daryn Brightblade)
     Re: Regular Expressions <rets@meta3.com>
     Re: Regular Expressions <cdm2@formalsys.ca>
     Re: Resource Kit Anomaly (I R A Aggie)
     Re: Seems to be just another  5.004_* bug:-( <rootbeer@teleport.com>
     strange thing (WOLtetch)
     Re: Telnet 3270 <cmargoli@world.northgrum.com>
     Re: Trying to parse referer_log??? <rootbeer@teleport.com>
     Re: Wanted: Wall/Schwartz book (1st ed) (Gabe Kostolny)
     Win32::internet (Mark E. Owen)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 1 Dec 1997 20:31:51 GMT
From: "David M Rosner" <dave@digidem.com>
Subject: calling C libraries from Perl and calling Perl libraries from C
Message-Id: <01bcfe8e$b2e0a850$7a1aa8c0@andersen13>

Is this possible? I want to compile C and Perl libraries and link them into
C and Perl programs. I haven't seen any reference to this, but i know
multi-language programming is common.

Any ideas?

thanks!

- david m rosner



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

Date: 01 Dec 1997 22:24:25 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
To: "David M Rosner" <dave@digidem.com>
Subject: Re: calling C libraries from Perl and calling Perl libraries from C
Message-Id: <oee67p8izgm.fsf@alpha.hut.fi>


Please tell your newsmaster that comp.lang.perl has not existed for ages.
The corresponding group is now called comp.lang.perl.misc.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: Mon, 01 Dec 1997 20:00:04 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Conditional compilation?
Message-Id: <3484163e.1851906@news.tornado.be>

Thilo Goetz <goetz@watson.ibm.com> wrote:

>So here it goes.  I wrote a lengthy perl script that uses some features
>of perl5, so it won't compile under perl4.  If somebody tries to run
>this script with an older version of perl, I'd like a controlled death
>like so:
>
>if ($] < 5.0) { die "$0 error: needs perl v. 5 or better, aborting.\n";
>}
>
>However, this line is never executed due to compilation errors when run
>under perl4.  So my question is, is there a standard way of handling
>this problem?  Do I need a metascript just to handle this?

What you could do is put the version-dendendant code into separate
script files. When you "require" a file, it will be compiled (and
immediate code will be executed).

(You may even look at the "do script" syntax.)

HTH,
Bart.


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

Date: Mon, 1 Dec 1997 11:45:03 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Josh <jmf9946@is4.nyu.pam>
Subject: Re: Conditional compilation?
Message-Id: <Pine.GSO.3.96.971201114328.28036F-100000@usertest.teleport.com>

On Mon, 1 Dec 1997, Josh wrote:

> Is this not why god & Larry gave us numerical requires?
> 
> require 5.004;
> 
> though I don't have a perl4 handy to test it on, so it's probably wrong.

Well, it's "right" in that it causes perl4 to abort, but it's "wrong" if
you hoped it would cause a compile-time error. Actually, most scripts
using 5.004ish features will cause a compile-time error in perl4, but they
don't usually exit cleanly. But since nobody uses perl4 any more, that's
not a problem. :-) 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 1 Dec 1997 20:25:25 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Conditional compilation?
Message-Id: <65v6fl$aid@news-central.tiac.net>

In article <Pine.GSO.3.96.971201114328.28036F-100000@usertest.teleport.com>,
Tom Phoenix  <rootbeer@teleport.com> wrote:

>[...] . But since nobody uses perl4 any more, that's
>not a problem. :-) 

Reports of the death of perl4.xxx are not true, athough many people seem
to be trying to help it along...

Mike (currently doctoring some "dead" perl 4 which seems to work quite
      well.)
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Mon, 01 Dec 1997 18:13:42 GMT
From: "DBlom" <dblom@istar.ca>
Subject: dumb(?) question about arrays ...
Message-Id: <01bcfe85$17929880$05cccccc@gumby>

Hi,
I am trying to write a Perl script to fix area codes in a Maximizer
database export file &  have been banging my head against what is probably
a very simple problem.  Each line in the file consists of quote-enclosed,
comma-delimited fields - in other words it looks just like an array (to me,
anyway).  I have been trying to read each line & convert it to an array
with something like
	@line = $_;
but when I try to reference @line[25] I get nothing, even though there is
information in the 25th field.  Is there some kind of type conversion that
I have to do??  Any help would be greatly appreciated.

Thanks

David Blom


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

Date: Mon, 1 Dec 1997 12:09:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Morten Simonsen <mortensi@idt.ntnu.no>
Subject: Re: each() does not work?!
Message-Id: <Pine.GSO.3.96.971201120717.28036N-100000@usertest.teleport.com>

On 1 Dec 1997, Morten Simonsen wrote:

> I have used each() many times before, and it has worked fine, but now
> it seems like something is wrong. I have a database at 1000 entries.
> When I tries to list the entries, only some of the entries are found
> by running each() on the DB. If I try to print the entry by
> 
> print $DB{$key}
> 
> I find all the entries that are not listed by using each(). The problem
> seems to arise when there are more than 350 entries. 

It could be a bug in the database code, or it could be that you're
altering the hash while you're iterating over it with each(). Without some
code, it's impossible to be sure.

> I use perl Perl for Win32 Build 306 version 5.003_07

There are much newer versions available. Do you still have problems with a
newer version? Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 01 Dec 1997 20:07:26 GMT
From: gkeene@watertown.com (Greg Keene)
Subject: gethostbyaddr on Win32 systems
Message-Id: <348318d9.36769872@news.pdx.oneworld.com>

Is there any way around the lack of gethostbyaddr support on Win32 systems?

Thanks,

Greg Keene


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

Date: 1 Dec 1997 20:22:56 GMT
From: kehoe@fc.hp.com (Jeff Kehoe)
Subject: Re: getopts on NT?
Message-Id: <65v6b0$qmp@fcnews.fc.hp.com>

Lokisdog (see.my.sig@nospam.com) wrote:
: Jeff Kehoe wrote:
: > 
: > Is there something special I need to do to use getopts() for perl on NT?
: > 

: < snipped>

: This works on NT:

: ++++++++++++++  Start Code Snippet  ++++++++++++++

: require "getopt.pl" || die "No getopt.pl";

: # =============> Extract the command line switch arguments

: &Getopt (se);
:    
: $start = $opt_s;     
: $end = $opt_e;       
:  
: # ============> Print them out to test

: print "Start is $start\n";
: print "End is $end\n";

: +++++++++++++++++++  End Code Snippet +++++++++++++++


: The output looks like this:

: D:\PerlScripts>opts.pl -s dog -e cat
: Start is dog
: End is cat

Eric,

I discovered that your solution doesn't work if I invoke the script
directy as you have shown.  If I type

D:\PerlScripts>perl opts.pl -s dog -e cat

it will work.  So something is wrong with my association or launching
of perl scripts.  Any ideas?

Thanks for your help,
Jeff


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

Date: Mon, 1 Dec 1997 11:58:06 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: localtime()
Message-Id: <Pine.GSO.3.96.971201115618.28036J-100000@usertest.teleport.com>

On 1 Dec 1997, Phil R Lawrence wrote:

> Camel pp. 185 states that the month element has range 0..11, weekday has
> range 0..6, and that the year has had 1900 subtracted from it.
> 
> I wonder why the day element doesn't also start at 0?

The month and day-of-week are often used as indices in zero-based arrays
of strings. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 1 Dec 1997 19:55:27 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: open and whitespace
Message-Id: <EKJ0oG.4oG@world.std.com>

Niall O Broin <nobroin@esoc.esa.de> writes:

>Subject: Re: open and whitespace
>On page 194 in Camel II it says

>But we've never actually seen anyone use that in a script...

>Well, of course, someone had to use it :-) 

[stuff deleted]
>Does anyone know why open strips leading and trailing whitespace ? After
>all, if a space is a legal character in a filename (as it is in most
>modern Unices, if a little hard to deal with via most shells), why
>shouldn't it be used ?

Here's my guess.

A lot of perl, especially a lot of early perl, was written to read
text files, munge the data, and output the results.

In many of the input files that perl was intended to deal with (like a
fixed column width report) when you extract the file name, you may get
leading or trailing whitespace (depending on whether the filename was
right or left justified in its column.)

Most of the time, the whitespace wasn't part of the filename, and
stripping it required two s/// statements. (The non-greedy match
solution shown in <URL:http://www.perl.com/CPAN/doc/manual/html/pod/
perlfaq4/How_do_I_strip_blank_space_from_.html> didn't exist until
perl 5. And since perl has a lot of DWIM (do what I mean) magic, why
not do the programmer a favor and remove the whitespace.

-- 
Andrew Langmead


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

Date: Mon, 1 Dec 1997 11:41:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Bob Maillet <bob@cafemedia.com>
Subject: Re: Outputting 100 lines at a time from a search
Message-Id: <Pine.GSO.3.96.971201114045.28036E-100000@usertest.teleport.com>

On Sun, 30 Nov 1997, Bob Maillet wrote:

> what I would like to do is output only 100 or so lines of text at a
> time..not just the first 100 but each hundred after that and so on. 

I think you could use the methods in one of Randal's first few Web
Techniques columns. Hope this helps! 

   http://www.stonehenge.com/merlyn/WebTechniques/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 01 Dec 1997 10:01:13 -0800
From: jlee <jlee@mdsi.bc.ca>
Subject: Passing one subroutine with parameters into another subroutine.
Message-Id: <3482FB69.271B@mdsi.bc.ca>

If I have the following 2 subroutines:

sub1 - will accept a string and a hash table as parameters.
sub2 - will accept another subroutine as a parameter.

Now, I want to pass sub1 as a parameter into sub2. Now in the body of
sub2,
I want call sub1 with a string and a hash table as parameters.

Does anyone know how to do this without using eval or if possible?

Thanks in advance.

Jerry
jlee@mdsi.bc.ca


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

Date: Mon, 01 Dec 1997 10:30:10 -0800
From: jlee <jlee@mdsi.bc.ca>
Subject: Re: Passing one subroutine with parameters into another subroutine.
Message-Id: <34830232.3E23@mdsi.bc.ca>

Figured it out.

Thanks anyway.

Jerry

jlee wrote:
> 
> If I have the following 2 subroutines:
> 
> sub1 - will accept a string and a hash table as parameters.
> sub2 - will accept another subroutine as a parameter.
> 
> Now, I want to pass sub1 as a parameter into sub2. Now in the body of
> sub2,
> I want call sub1 with a string and a hash table as parameters.
> 
> Does anyone know how to do this without using eval or if possible?
> 
> Thanks in advance.
> 
> Jerry
> jlee@mdsi.bc.ca


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

Date: Mon, 01 Dec 1997 12:54:43 -0600
From: Ken Holm <rets@meta3.com>
Subject: Re: Passing one subroutine with parameters into another subroutine.
Message-Id: <348307F3.2781@meta3.com>

jlee wrote:
> 
> If I have the following 2 subroutines:
> 
> sub1 - will accept a string and a hash table as parameters.
> sub2 - will accept another subroutine as a parameter.
> 
> Now, I want to pass sub1 as a parameter into sub2. Now in the body of
> sub2,
> I want call sub1 with a string and a hash table as parameters.

I think I got it...  

#!/usr/bin/perl5 -w

my $Spatula = "Ukelele";

Hoagie($Spatula);

exit;

sub Ukelele {
    my ($Medallion, $Garbanzo) = @_;
    my %Garbanzo = %$Garbanzo;

    print "$Medallion = $Garbanzo{$Medallion}\n";
    return();
}

sub Hoagie {
    my ($Sub) = @_;
    my $Weiner = "Flag";
    my %Museum = ("Flag" => "On");
    &$Sub($Weiner, \%Museum);
}

Is that what you're talking about?

-K

-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Mon, 1 Dec 1997 12:15:17 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: jlee <jlee@mdsi.bc.ca>
Subject: Re: Passing one subroutine with parameters into another subroutine.
Message-Id: <Pine.GSO.3.96.971201120935.28036O-100000@usertest.teleport.com>

On Mon, 1 Dec 1997, jlee wrote:

> If I have the following 2 subroutines:
> 
> sub1 - will accept a string and a hash table as parameters.
> sub2 - will accept another subroutine as a parameter.

That is, sub2 is looking for a coderef? 

> Now, I want to pass sub1 as a parameter into sub2. Now in the body of
> sub2, I want call sub1 with a string and a hash table as parameters. 
> 
> Does anyone know how to do this without using eval or if possible?

Sounds like references to me. Check out the perlref manpage, and this
example. Hope this helps!

    sub sub1 {
	my($string, $hashref) = @_;
	my $hashsize = keys %$hashref;
	print "sub1 got '$string' and a hash of $hashsize elems.\n"; 
    }

    sub sub2 {
	my($coderef) = @_;
	my $str = "the string";
	my %hash = qw/fred 45 barney 38 betty 35 wilma 41/;
	&$coderef($str, \%hash);
    }

    sub2(\&sub1);

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Mon, 1 Dec 1997 20:01:35 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Passing one subroutine with parameters into another subroutine.
Message-Id: <EKJ0yn.92G@world.std.com>

jlee <jlee@mdsi.bc.ca> writes [with various snippets cut to keep my
Original Content Ratio score high]:

>Figured it out.

>jlee wrote:
>> 
>> Now, I want to pass sub1 as a parameter into sub2. Now in the body of
>> sub2,
>> I want call sub1 with a string and a hash table as parameters.

And you're going to keep it a secret?

The way I thought of doing it was with passing an anonymous subroutine
reference to sub1:

sub2(sub {sub1($string, %hash)}); # assuming $string and %hash are my()'d

Did you come up with another one?
-- 
Andrew Langmead


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

Date: Mon, 1 Dec 1997 12:02:27 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: Please help with form script
Message-Id: <Pine.GSO.3.96.971201120035.28036L-100000@usertest.teleport.com>

On Mon, 1 Dec 1997, TechMaster Pinyan wrote:

> #!/usr/local/bin/perl
> require("cgi-lib.pl"); #SOMETHING WRONG WITH THIS LINE???

Yes. You should encourage people to use CGI.pm (or a similar module)
rather than cgi-lib.pl. It's easier to use and debug, and it comes with
recent versions of Perl.

> open (DATA, ">>data.txt") || die ("Couldn't write to data file.\n");

DATA is a built-in filehandle, like STDIN is. It's probably better to
choose another name.

Cheers!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 01 Dec 1997 13:40:32 -0500
From: Curtis Hrischuk <ceh@sunspot.sce.carleton.ca>
Subject: problem using eval with array of file test operators
Message-Id: <wkdsosc3o0v.fsf@sunspot.sce.carleton.ca>

Hi.  I am trying to write a method which prints out the status of a
file using the file test operators.  The code is shown below.  I am
having a problem trying to figure out how to set up the command text
string and using eval.  I keep getting the error 'Scalar found where
operator expected at (eval 50) line 1, at end of line (#2)'.  The
operation never failes either, even though the tests are mutually
exclusive. 

Please someone explain this to me.

Curtis
================================================================

sub file_tests
{
  my $self = shift;
  my($fname) = @_;
  my( @test ) = (
		 ['-r', "File is %s readable by effective uid\n" ],
		 ['-w', "File is %s writable by effective uid\n" ],
		 ['-x', "File is %s executable by effective uid\n" ],
		 ['-o', "File is %s owned by effective uid\n" ],
		 ['-R', "File is %s readable by real uid\n" ],
		 ['-W', "File is %s writable by real uid\n" ],
		 ['-X', "File is %s executable by real uid\n" ],
		 ['-O', "File is %s owned by real uid\n" ],
		 ['-e', "File does %s exist\n" ],
		 ['-z', "File does %s have zero size\n" ],
		 ['-s', "File does %s have zero non-size\n" ],
		 ['-f', "File is %s a plain file\n" ],
		 ['-d', "File is %s a directory\n" ],
		 ['-l', "File is %s a symbolic link\n" ],
		 ['-S', "File is %s a socket\n" ],
		 ['-p', "File is %s a named pipe\n" ],
		 ['-b', "File is %s a block file\n" ],
		 ['-c', "File is %s a character special file\n" ],
		 ['-u', "File does %s have setuid bit set\n" ],
		 ['-g', "File does %s have setgid bit set\n" ],
		 ['-k', "File does %s have sticky bit set\n" ],
		 ['-t', "Filehandle is %s opened to a tty\n" ],
		 ['-T', "File is %s a text file\n" ],
		 ['-B', "File is %s a binary file\n" ]
	      );

  my( $ftest, $result, $qualifier, $ratest, $command );
  foreach $ratest ( @test ) {

    $ftest = $$ratest[0];
    $result = $$ratest[1];
    
    $command =     
    'if ( $ftest $fname ) {
      $qualifier = "";
    } else {
      $qualifier = "not";
    }';
    
    print "Command is $command\n";  
    eval $command ;
    printf($result, $qualifier);
  }

}


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

Date: Mon, 1 Dec 1997 12:21:13 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Curtis Hrischuk <ceh@sunspot.sce.carleton.ca>
Subject: Re: problem using eval with array of file test operators
Message-Id: <Pine.GSO.3.96.971201121556.28036P-100000@usertest.teleport.com>

On 1 Dec 1997, Curtis Hrischuk wrote:

> Hi.  I am trying to write a method which prints out the status of a
> file using the file test operators.  The code is shown below.  I am
> having a problem trying to figure out how to set up the command text
> string and using eval.  

Why should you use eval? It's better to avoid eval STRING, in general. But
if you want to use many filetest operators on the same file, you can
save a lot of time if you just stat it once, then use the underscore
pseudo-filehandle.

    for $filename (@files) {
	unless (stat $filename) {	# Load up the info
	    print "Can't stat file '$filename': $!";
	    next;
	}
	print "Concerning file '$filename':\n";
	print "  it's readable\n" if -r _;
	print "  it's writable\n" if -w _;
	...
	print "\n";
    }

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Tue, 02 Dec 1997 04:28:39 GMT
From: daryn@solamnia.demon.co.uk (Daryn Brightblade)
Subject: Random numbers, perl and win95 :(
Message-Id: <881008097.13813.0.nnrp-04.c2de12b5@news.demon.co.uk>

O-kaaaaay...
this is my problem, anyone who's kind enough to read this.

for some godforsaken reason, after reinstalling perl for win32's onto
my win95 pc, the random number generator refuses to generate random
numbers and for some damn reason continually comes up with 125 from a
piece of code looking like

$file=int(rand(100000));
print $filename;

and I have NO idea why the damn perl interpreter refuses to do it,
since the random function worked with the previous installation...

Any ideas... please? It's urgent since it's to do with work and I need
it for a mail redirection program
pleeeeeeeeeeeeeeeeeeeeeeeease
(pathetic begging, I know but I'm too tired to put much into it)

Thank you..


Daryn Brightblade
Comrades in Arms, Brothers in Peace, the Clan Brightblade
http://www.solamnia.demon.co.uk/



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

Date: Mon, 01 Dec 1997 12:43:26 -0600
From: Ken Holm <rets@meta3.com>
Subject: Re: Regular Expressions
Message-Id: <3483054E.167E@meta3.com>

David Siebert wrote:
> 
> I have the Camal but but this section is notvery clear. I need to convert \n
> and \c\n to <BR> any suggestions?

If you mean you would like to replace all of the newlines and carriage
return/line feeds with <BR> you can use:

$Line =~ s/(\cM)?\n/<BR>/g;

If you mean what you said you should use:

$Line =~ s/(\c)?\n/<BR>/g;

Jeff Fr(ie|ei)dl has a great book - Mastering Regular Expressions
[O'Reilly & Assoc.]  

Please forgive not knowing how to spell Jefff's name.  My book is (sigh)
at home.

-K
-- 
Kennneth A Holm  |        META 3 - Webmaster        |webmaster@meta3.com
PO Box 1508      |----------------------------------|(601)948.3399 x 227
Jackson, MS 39215|PGP Key finger webmaster@meta3.com|(601)948.5999 (fax)


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

Date: Mon, 01 Dec 1997 14:02:42 -0400
From: Craig Morris <cdm2@formalsys.ca>
Subject: Re: Regular Expressions
Message-Id: <3482FBC2.1CD7@formalsys.ca>

David Siebert wrote:
> 
> I have the Camal but but this section is notvery clear. I need to convert \n
> and \c\n to <BR> any suggestions?

Try this:

$line =~ s/\n|(\c\n)/<BR>/g;

where $line represents a line of text.


Craig Morris


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

Date: Mon, 01 Dec 1997 13:55:04 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Resource Kit Anomaly
Message-Id: <-0112971355040001@aggie.coaps.fsu.edu>

In article <3482206a.117001088@woody.wcnet.org>, jzawodn@wcnet.org (Jeremy
D. Zawodny) wrote:

+ Amazon.com is very cruel. They have implemented a new feature called
+ "one-click ordering". Believe me, it's just that easy.

Amazon is also an unrepentent spam site. Do a search on Dejanews for
'Amazon' in the news.net-abuse.* newsgroups.

James - makes that choice _quite_ easy...

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Mon, 1 Dec 1997 12:06:47 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vladimir Sovetov <sova@kpbank.ru>
Subject: Re: Seems to be just another  5.004_* bug:-(
Message-Id: <Pine.GSO.3.96.971201120544.28036M-100000@usertest.teleport.com>

On 1 Dec 1997, Vladimir Sovetov wrote:

> 2. And perl -v
>  This is perl, version 5.004_04 built for i386-bsdos
> 
>   HANG-UP!!!!

I don't know what you're meaning by that. Are you saying that the command
'perl -v' somehow disconnects your network?

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 1 Dec 1997 20:48:46 GMT
From: woltetch@aol.com (WOLtetch)
Subject: strange thing
Message-Id: <19971201204801.PAA22949@ladder01.news.aol.com>

I have encountered satatements like this:
$variable if /pattern/

could someone explain how this works? Do only the matches end up in &variable?


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

Date: Mon, 1 Dec 1997 18:15:04 GMT
From: Charles Margolin <cmargoli@world.northgrum.com>
Subject: Re: Telnet 3270
Message-Id: <3482FEA8.2C06@world.northgrum.com>

Bert Tijhuis wrote:
> 
> Does anyone has some experience with Telnet to a IBM Mainframe which is
> running TCP/IP.
> I'want to automate some processes to catch some values from the Mainframe.
> Using telnet to another system is not so difficult when it is a UNIX system.
> 
> Does anyone have a sample script that communicates with the mainframe.
> 
> kind regards, bert Tijhuis

I don't have a simple script, just a suggestion, if you are running
Unix with X.  I use x3270 with the -script option along with Perl's
IPC::Open2.  Then you can write x3270's scripting commands from your
perl program and read the results, which can include screen contents,
into a Perl array.  Works well.

-- 
Charles G. Margolin                   DSSD Internal Information Services
cmargoli@world.northgrum.com          Northrop Grumman Corp. 0624/23
margolin@acm.org                      Hawthorne, California 90250-3277


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

Date: Mon, 1 Dec 1997 11:40:02 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: prog@wallybox.cei.net
Subject: Re: Trying to parse referer_log???
Message-Id: <Pine.GSO.3.96.971201113657.28036D-100000@usertest.teleport.com>

On 30 Nov 1997 prog@wallybox.cei.net wrote:

> is there anyway to strip out all the "blanks"
> from the end of a line.  

Yes; use the s/// operator to do that.

> 	($from, $filler1, $file) = split(' ', $_);
>     if (/wallybox.cei.net/) { #	I don't care to know my site
> 	 } 	# probably ugly, but I don't know another way....

That regular expression is doing more than you want. How about saying
something like this?

    next if $from eq 'wallybox.cei.net';

And maybe you don't need your "filler". Could you use a regular expression
to parse the data? And, when it doesn't match, to warn you about odd lines
in the input? Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 1 Dec 1997 10:19:00 -0800
From: gabe@sonic.net (Gabe Kostolny)
Subject: Re: Wanted: Wall/Schwartz book (1st ed)
Message-Id: <65uv2k$d62@bolt.sonic.net>

Sitaram Chamarty (sitaram@diac.com) wrote:
: On 09 Oct 1997 19:54:02 +0200, Oliver Flimm <flimm@ph-cip.uni-koeln.de> wrote:
: >I got my panther book here in germany on 16.9. - and I like it a lot ;-) 
: 
: Err, umm, what is the panther book?  Am I behind in my purchase of Perl books
: (from ORA only, I may add)? :-)
panther is advanced perl, i believe.

-g
-- 
Gabriel Kostolny


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

Date: Mon, 01 Dec 1997 18:18:52 GMT
From: meo@enterprise.net (Mark E. Owen)
Subject: Win32::internet
Message-Id: <3482fef3.281442@news.enterprise.net>


Is there any web pages about that has some useful examples on how to
use the Win32::internet (internet.pm) module?

I'm specifically looking to be able to download various GIF/JPEG files
from web sites (eg. http://host/foo.jpg)

Any help would be greatly appreciated!

Please send any details to meo@enterprise.net

Cheers
Mark E. Owen
---
Mark E. Owen
meo@enterprise.net
UK WEATHER-http://homepages.enterprise.net/meo/weather


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1397
**************************************

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