[6590] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 215 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 1 16:27:42 1997

Date: Tue, 1 Apr 97 13:00:22 -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           Tue, 1 Apr 1997     Volume: 8 Number: 215

Today's topics:
     5.004beta and $& (Igal Iancu)
     \n problem??? compatibility with dos <pelatimtt@poboxes.com>
     Adding report-like header for each printed page (Philip Zubaly)
     Re: Finding first day of a month <rcadmus@mcmsys.com>
     Re: Finding first day of a month <skinnard@vcd.hp.com>
     Forms and Kanji/JIS (Craig A. Keefner)
     Re: global my() variable used in foreach() loop loses i (Ian Flanigan)
     Re: Has anyone heard the rumour that Microsoft have bou (Derek Bell)
     Help with Win32::ODBC, PerlIS.dll, and corrupted data s jcoleman@alison.sbc.edu
     HELP:  reading from a file in NT <logic@jhu.edu>
     How to access shadowed passwords? (Sergio Giovannini)
     Re: Is Perl the ultimate scripting language? <seay@absyss.fr>
     Re: Log base 10 (Joel Coltoff)
     New Microsoft Perl Product (fwd) (Alan Bostick)
     Perl Positions / Immediate Opportunties <balacynwyd@edpcs.com>
     Perl script for UNIX mail to produce web page? <ccq@cs.stanford.edu>
     Re: Quick Help <seay@absyss.fr>
     SOLVED: Who makes more $$, C or Perl programmers? <eryq@enteract.com>
     Re: substituting with /g and simulating "lookbehind" <dbenhur@egames.com>
     Re: substituting with /g and simulating "lookbehind" (Tad McClellan)
     Re: substituting with /g and simulating "lookbehind" <ajohnson@gpu.srv.ualberta.ca>
     Re: trouble with pipes (Charles DeRykus)
     Using Perl with MS-Access (Kevin Posen)
     wherefrom? (Jens Ostermann)
     wheretoget? (Jens Ostermann)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 31 Mar 1997 07:02:25 GMT
From: iancu@iil.intel.com (Igal Iancu)
Subject: 5.004beta and $&
Message-Id: <5hnni1$k76@itnews.sc.intel.com>


Hi,

I have a rather long perl program which uses $& "and
friends" in may places.  Though I know I should probably
do without them, I sometimes have to.  Enter 5.004beta,
and seems that it is much more sensitive than 5.003.

See this example code, and the output for the two
perl versions:

(The search I am doing uses "while"  and "foreach"
and compares them. I believe the "foreach" does not
refer to $&, therefore, not effected by it's setting (??)) 

############### start ############

#!/usr/bin/perl

print "Perl version $]\n";

$| = 1;			#flush stdout

#initial big string to search

$string = "0" x 25000 ;

# !!! watch here !!!!
#set the program to use $&.  
$dummy = $&;           

########################
#do the search - while

$found = 0;
print "search using while .. ";

$start = (times)[0];   #start timer

while ($string =~ /0/g) {
	$found++;
}

$end = (times)[0];     #stop timer
$delta = $end - $start;

print "found $found, $delta sec\n";

########################
#do the search - foreach

$found = 0;
pos $string = 0; 	#needed in perl 5.004beta
print "search using foreach .. ";

$start = (times)[0];   #start timer

foreach ($string =~ /0/g) {
	$found++;
}

$end = (times)[0];     #stop timer
$delta = $end - $start;

print "found $found, $delta sec\n";

############# end ###############

and now, test the two versions: 

>perl-5.003 test1.pl
Perl version 5.003
search using while .. found 25000, 0.33 sec
search using foreach .. found 25000, 0.63 sec

>perl-5.004 test1.pl
Perl version 5.00393
search using while .. found 25000, 5.15 sec
search using foreach .. found 25000, 0.78 sec

If I remove line 13 ($dummy = $&;)  both versions
behave the same.  (BTW, if somebody gets a chance,
I would like to know why "foreach" is twice as slow 
as "while", even in 5.003)

This happens on both AIX-325 and HPUX-10. I am not using
perl's malloc or any special tuning.

thanks in advance,

Igal Iancu
iancu@iil.intel.com


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

Date: 1 Apr 1997 17:54:35 GMT
From: "Matteo Pelati" <pelatimtt@poboxes.com>
Subject: \n problem??? compatibility with dos
Message-Id: <01bc3dfc$33b9d180$2f4078c3@pelati>

I have written a perl routine that creates a file containing some newline
chars (\n). This script runs on a Unix machine. When I download the file
created by my perl routine I can't read it under Windows with a Visual
basic application because VB doesn't recognize the unix newline char so I
get an error?
Is there a way to write the dos newline char with a perl script under unix?

Thanks
Regards

Email to : pelatimtt@poboxes.com
 


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

Date: 1 Apr 1997 17:32:00 GMT
From: zubaly@z-ware.com (Philip Zubaly)
Subject: Adding report-like header for each printed page
Message-Id: <5hrgqg$lst$1@zeus.crosslink.net>

Hello--

I am new to Perl.

Does anyone know of an existing script that will take a long HTML page of data 
and add report-like data header information so that this header data will show 
at the top of each page when printed?  I have been unsuccessful in finding a 
method for doing this using HTML.

Thanks ---



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

Date: 1 Apr 97 14:47:01 GMT
From: "Ray Cadmus" <rcadmus@mcmsys.com>
Subject: Re: Finding first day of a month
Message-Id: <01bc3eab$8e5d4c20$9492140a@cbs07>

Scott Kinard <skinnard@vcd.hp.com> wrote in article
<33400739.4B4D@vcd.hp.com>...
> I know I could use the current day/date  info  returned from the Unix
date command and count 
> backwards and such to  determine  this value, however, I need this to
work for any month/year, not just
> the  current one.

Actually you CAN do that.  The key is in the use of timelocal().  Get
today's date and do your normal localtime.  Then change month, year,
whatever and do timelocal() to get back to seconds - then localtime() to
re-establish day of week etc. - works.



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

Date: Tue, 01 Apr 1997 11:44:49 -0800
From: Scott Kinard <skinnard@vcd.hp.com>
Subject: Re: Finding first day of a month
Message-Id: <334165B1.64A8@vcd.hp.com>

Greetings,

Problem solved. After searching around for a few days I found the 
info I needed in a set of comp.lang.perl archives located at 
http://www.metronet.com:70/1/perlinfo/scripts.
     
The actual code is quite compact and boils down to one calculation:

# Set $d to date (1-31), $m to month (1-12), $y to year (e.g. 1994).

@d = (0,3,2,5,0,3,5,1,4,6,2,4);
@day = (Sun, Mon, Tue, Wed, Thu, Fri, Sat);
$y-- if $m < 3;

# $day gives the day.
$day = $day[($y+int($y/4)-int($y/100)+int($y/400)+$d[$m-1]+$d) % 7];

Thanks for your suggestions.     
Scott
-- 
=================================================
                 Scott Kinard 
              kinards@teleport.com
        http://www.teleport.com/~kinards

      ---===<<< Will Code For Food >>>===---    
=================================================


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

Date: 1 Apr 1997 13:31:03 -0700
From: keefner@primenet.com (Craig A. Keefner)
Subject: Forms and Kanji/JIS
Message-Id: <33410d4b.575787@news.primenet.com>

I want to use something Matts formmail to create a mail form
that my Japanese clients can use from their machine.

Are their CPAN modules for Japanese which allow for that
sort of processing?

Craig


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

Date: 1 Apr 97 19:18:06 GMT
From: flan@echo.echo.com (Ian Flanigan)
Subject: Re: global my() variable used in foreach() loop loses its value
Message-Id: <flan.859922286@echo.echo.com>

rnewman@shell1.cybercom.net (Ron Newman) writes:

>Here's a Perl script whose behavior I don't understand at all.

Well the problem has to do with closures and variable binding.  When
you declare a function within the scope of a lexical variable (in this
case $topic), it remembers which variable it's pointed at.  Therefore,
in your program, the $topic variable in subroutine() is bound to your
declared $topic variable.  HOWEVER in main, $topic is bound
*locally*.

Yeah, that's confusing, but it's in the manual:

     Foreach Loops
 
     The foreach loop iterates over a normal list value and sets
     the variable VAR to be each element of the list in turn.
     The variable is implicitly local to the loop and regains its
     former value upon exiting the loop.  If the variable was
     previously declared with my, it uses that variable instead
     of the global one, but it's still localized to the loop.
     This can cause problems if you have subroutine or format
     declarations within that block's scope.

Making the variable a true package global is probably a better idea.
(Even better is passing it as a parameter.)

Hope this helps.

--
Ian Flanigan
flan@cs.wustl.edu


BTW, to see the strange binding in action, change your script to:

my $topic = "global";

main();

sub main {
    my @topics = ("first", "second", "third", "fourth");
    print "Before loop: topic is $topic\n";
    foreach $topic (@topics) {
        print "In loop: topic is $topic\n";
        subroutine();
    }
    print "After loop: topic is $topic\n";
}
 
 
sub subroutine {
    print "In subroutine: topic is $topic\n";
}


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

Date: 1 Apr 1997 20:48:14 +0100
From: dbell@maths.tcd.ie (Derek Bell)
Subject: Re: Has anyone heard the rumour that Microsoft have bought Perl?
Message-Id: <5hropu$706@bell.maths.tcd.ie>

	I understand Microsoft are putting Bigfoot and Elvis in charge of their
Perl line!

	Seriously, I think this is a distorted version of news that Microsoft
have paid Activeware to port Perl to Win32 platform. That was last mentioned in
this ng a couple of months ago.

	Derek
-- 
Derek Bell  dbell@maths.tcd.ie WWW: http://www.maths.tcd.ie/~dbell/index.html
              PGPkey: http://www.maths.tcd.ie/~dbell/key.asc

              Windows not found: (C)heer, (D)ance, (P)arty?


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

Date: 1 Apr 97 14:55:57 EDT
From: jcoleman@alison.sbc.edu
Subject: Help with Win32::ODBC, PerlIS.dll, and corrupted data sources
Message-Id: <1997Apr1.145557.277@alison.sbc.edu>

I am running Perl for Win32 (PerlIS.dll), NT 4.0, Access 95, and IIS 3.

The problem I am having is with corrupted data.

When several users access the site at the same time, I sometimes end up with a
corrupted data source.  The users are doing nothing more than simple queries,
and in some cases an update to their own individual records in a database.

Each user has one record in the database, consisting of a username, their 
"group" name, and a field that tells whether or not they've actually been to
the site before.  Users must log in using basic authentication.

The initial page checks if they've accessed the site before, and if they\
haven't, they are prompted to change their password.  Once this is changed, 
they go to the main page.

The problem is, when several users initially change their password at once,
the database is corrupted, and I start getting a perl error:
Can't call method Sql without a package or object reference at line...

Anyway, once I repair the database, all is well.  But how can I keep this from
happening?  I think I might be able to utilize Win32::NetAdmin for some more
efficient methods of access tracking, but the users also have the option to 
access another database with student records.  They can make changes to this
one too...is there a limit to the number of users that can make changes to a
data source at a certain time?  Should I limit the number of connections to
the site?

Please help...the big rollout is tomorrow, and we've only recently encountered
this problem...as in about two hours ago...

Thanks,

John Coleman
jcoleman@sbc.edu



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

Date: Tue, 01 Apr 1997 12:22:41 -0500
From: "Andrew T. Loyer" <logic@jhu.edu>
Subject: HELP:  reading from a file in NT
Message-Id: <33414461.723A@jhu.edu>

hello,

i am having trouble reading from a list of local files in WinNT.  I have
a list of files in @ARR.  then i try and do the following:

foreach $file2 (@ARR) {
	open(IN2, "< $file2") or die "dead";
	@FILELIST = <IN2>;
	close IN2;
	foreach $line (@FILELIST) {
		if($line =~ s/\<body\>/\<body bgcolor=\#ffffff\>/i) {
			print "worked\n";
		}
		else { print "not found\n"; }
	}
	open OUT2, "> $file2";
	print OUT2 @FILELIST;
	close OUT2;

}

Obviously, I am trying to change all <body> tags in a html file into
<body bgcolor=#ffffff>.  This should work fine, but after some debugging
i found that nothing is being read into @FILELIST.  @FILELIST is empty. 
I can't see what i have done wrong.  

i checked the file premissions in NT and they are fine.  The file is
just an ordinary text file.

Can someone help?

thank you very much,

andy loyer
logic@jhu.edu


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

Date: Tue, 01 Apr 1997 17:01:05 GMT
From: sgiovann@mail.prog.arch.unige.it (Sergio Giovannini)
Subject: How to access shadowed passwords?
Message-Id: <333fc45c.7119930@news.iol.it>

Hi, 
I am goint to write a mail gateway for our server at my university,
but before all I would like to know how to access to the shadowed
passwords (located in /etc/shadow instead of /etc/passwd).
Does Perl use that file automatically (i fear not) when it access to
the passwd struct?
Or I need a patch or something like to the perl itself?
I use a server running Linux (2.1.x) and Perl 5.002, but i think that
is not important.
Please reply via email, because i don't follow always this newsgroup
(too many articles for my modem connection :-(

Bye and thanx.

Sergio Giovannini
Sergio Giovannini
Student of the Architectural School of Genoa, Italy

Email: sgiovannini@mail.prog.arch.unige.it
       sergio.giovannini@iol.it
PGP public key available
HomePage: http://www.prog.arch.unige.it/~sgiovann
WWW site: http://www.prog.arch.unige.it 


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

Date: Tue, 01 Apr 1997 19:05:41 +0100
From: Douglas Seay <seay@absyss.fr>
To: "Dr. B. Hurzeler" <behurzeler@ucdavis.edu>
Subject: Re: Is Perl the ultimate scripting language?
Message-Id: <33415C85.104B@absyss.fr>

Dr. B. Hurzeler wrote:
> 
> Is Perl the ultimate scripting language?
> 
> This is probably a stupid question to ask in this news group but I try
> anyway. I would really appreciate your comments! Please be as objective
> as you can, I know it is hard!
> 
> So here is the question once more:
> 
> Are there any other scripting languages that can do what Perl
> does? (JavaScript, ObjectREXX, and others)

I dunno about JavaScript, nor the Object extensions to REXX,
but I worked using REXX on VM/CMS when I was an undergrad.
This was years ago (1988-90).


** warning: this isn't very Perl oriented **


> I include a list of requirements:
> 
> 1. Base Script Language: Basic capabilities to execute, loop, test &
> branch with full range of boolean operators, math, date-time arithmetic,
> full range of data-type (numeric, text, date, BLOB, arrays) manipulate
> text, pass commands to host product, pass commands to system,
> initiate/terminate processes both on the local and remote machine.
> Environment variables: ability to read and set values.
> API: ability to call program library routines from scripting language.

Sure, it had all that.  The "program library routines" were
simply other scripts that were imported as needed.  I don't think
that you could remotely launch programs unless you had some sort
of server waiting at the other end.  VM/CMS isn't Unix, you can't
hop around with rsh.  And VM/CMS doesn't allow launching of
background tasks, but I'd guess that a modern version of REXX
would let you do this (sheesh, /bin/csh lets you and it sucks).
As a rule, I think that Perl does things better than REXX, the
only exception is arrays.  In REXX you can do things like

	array. = SOME_DEFAULT_VALUE

and whenever you access array (item 3 would be array.3), it
will be SOME_DEFAULT_VALUE unless you specifically gave it
something else.

Question about "API:", is this some form of link with
a .a file (which Perl does via .xs files)?  If so, the
old REXX could not do anthing thing like that.  You would
need to build a small group of programs using PL/1
(this was IBM after all) and call them from the REXX exec.


> 2. Scripting Language Is Both "Outside" and "Inside". - Outside: Ability
> to invoke and sequence process execution, pass parameter, accept and
> handle error codes which are returned. Inside: Ability to invoke
> commands within process. Conditional structures to test the values of
> settings, respond to alerts and dialog boxes, branch on user inputs
> control sequencing and (in general) respond to the program outputs.

call other programs: check
internal commands (subroutines): check


> 3. Ability to Invoke The Same Set of Commands and Functions as can be
> Invoked via the GUI Interface - invoke commands, select dialogs box
> options and change settings.

At IBM there are (were?) several libraries for dialog
stuff, but all fancy TTY stuff, not real graphics.
In addition to the ISPF stuff, it was made to work
with the XEDIT editor.  But that is all library stuff,
not part of the base language (just like Perl).


> 4. Provide for Program Initialization File - Ability to initialize
> program settings and environment to know values at the start of
> execution (similar to .cshrc, or like an .ini)

Dot files don't really exists in CMS.  There was a one time
startup script (PROFILE EXEC A) that could be used to set
"global variables", including those set in earlir sessions
(written as plain text in a file).


> 5. Marcos - Macros with parameters. Can be run by users interactively,
> or by bootstrap (hands - off execution).

REXX do macros?  Of course.  It was (is?) the macro language
for the XEDIT editor (not to be confused with Xedit that
comes with X11 distributions).  I had a whole battery of
scripts for waiting for events/timers that would look around
and do whatever needed to be done.  I did all the debugging
from the command line, but the real execution was "detached".


> 6. GUI Components - Allow user interaction with the script. Invoke GUI
> components during the execution of scripts. Bring up a GUI alert, dialog
> box, selection list, etc. Respond to control, input, and related events
> signaled in GUI component, by the user.

GUI: as I said, fancy text and simple graphics (borders, etc).
No WIMP at all.  For the really complicated stuff, you write
it as a XEDIT macro and manipulate the editor.  Kinda strange
way of thinking, but it was extremely powerful.


> 7. Drag and Drop GUI Component Editor -  Allow interactive drag and drop
> creation and editing of GUI components to be used by scripts.

Sure, within the constraints of XEDIT (drag-n-drop == cut-n-paste).


> 8. The Scripting Language should be usable one many different platforms.

REXX was written for VM/CMS, but it exists in Unix (Uni-REXX) and 
it is kinda popular on Amigas (AREXX).  I always thought that it was
kinda tied to the VM/CMS environment (stacks were CMS, not REXX),
but that hasn't seemed to be a problem.


> 9. The Scripting Language should support Composite Applications, OpenDoc
> Compound Documents.

Dunno what you mean here.  If it is text,
munge it all you want.  If it isn't, get
a library to convert it to text.


> 10. It should make it possible to make applications "scriptable"
> through: Wrapping, Object modeling or Factoring.

Again, you need to be more clear.


> 11. It should make Agent-Based Computing possible.

It is a programming language, so yes, any
form of computing is possible.  Easy: that
is another topic.  REXX was made for text
and command execution (launching executables).
The closer you stay to these roots, the
easier your life will be.


I have always thought that Perl was the better
(ie - more powerful and more fun) language,
but REXX could do a lot too.  If you platform
will be Unix or something close, the Perl way
of doing things is more consistant with Unix
(ie - crazy and bizarre, but in the same way
as the rest).

What I'd like to know is what you really want to
do.  Most everything you have here can be done
with a good shell (I'd recommend bash, but others
would say ksh) and lots of advil.  The good ol'
workhorse language C can do it too.

I would chose Perl, but I chose Perl for just
about everything.  Good luck finding your
language of choice.

- doug


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

Date: Tue, 1 Apr 1997 17:21:29 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: Log base 10
Message-Id: <5hrg69$36h@netaxs.com>

In article <33413A4A.6C5E@cse.psu.edu>,
Lawrence Morroni Jr  <morronij@cse.psu.edu> wrote:
>I need to use the Log base 10 function for an experiment I am doing
>using perl.  I see that Log base e is built in to the language, but
>can't seem to find anythign on base 10.  Any suggestions?

Don't they teach math in the Comp. Sci. department anymore? Yes I have
a suggestion but you won't like it. As an alternative I'll offer these.
Go dig out your high school math book and look up how to go from one log
base to another. Or you can get one of the math modules from CPAN. Or you
can do a search of dejanews to see if this question has been asked before.
In the interim you can try this. I fetched it from dejanews for you.

    sub log10 ($) { log($_[0]) / log(10) }

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

Date: Tue, 1 Apr 1997 16:11:09 GMT
From: abostick@netcom.com (Alan Bostick)
Subject: New Microsoft Perl Product (fwd)
Message-Id: <dOTQz8m9LomZ085yn@netcom.com>

The following showed up in my mailbox.  I thought I'd share it with
everyone.

> MICROSOFT VISUAL PERL++ ADDS ENORMOUS POWER AND EASE OF USE TO A
> PROGRAMMING FAVORITE.
> 
> 
> April 1, 1997
> For Immediate Release
> 
> 
> 
> REDMOND, WASHINGTON - Microsoft Corporation announced today that it will
> soon be releasing the latest success in its series of programming
> language solutions:  Visual Perl++ 
> 
> For years, programmers have been enchanted by the power and utility of
> Perl, a scripting language that has proven itself in applications
> ranging from system administration to the World Wide Web.
> 
> Now Microsoft synergizes that power and utility with Object-Oriented
> Programming and Microsoft's Object Linking and Embedding (OLE) support 
> with Visual Perl++, multiplying them beyond imagining and bringing them 
> to the Windows 95 environment.
> 
> Microsoft's large team of experienced developers started with Perl, and
> made it even better, adding these exciting new features:
> 
> 	*	New fundamental data types, for increased versatility
> 
> 	*	Stronger type-checking for a more efficient development
> 		cycle
> 
> 	*	Support for classes, for virtually unlimited extension
> 		of available data types.
> 
> 	*	Support for Microsoft Foundation Classes (MFC) and
> 		Object Linking and Embedding (OLE).
> 
> 	*	The Visual Perl++ Workbench, a complete environment for
> 		developing and debugging Visual Perl++ applications.
> 
> 	*	Translator Wizard - a utility to translate Visual Perl++
> 		source code into C++, ready for compiling and linking to
> 		executables.
> 
> 
> Make the switch to Visual Perl++ and you will cease to be "just another
> Perl hacker" - you'll become a Windows 95 Programming Powerhouse!


-- 
Alan Bostick               | "You're a lawyer, I'm a vampire.  There is
mailto:abostick@netcom.com | such a thing as professional courtesy."
news:alt.grelb             |      Stephen Dedman, "Never Seen by Waking Eyes"
http://www.alumni.caltech.edu/~abostick



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

Date: Tue, 01 Apr 1997 15:43:40 -0800
From: Loren King <balacynwyd@edpcs.com>
Subject: Perl Positions / Immediate Opportunties
Message-Id: <33419DAC.166@edpcs.com>

Enjoy the flexibility of consulting while benefiting 
from the stability of working with an industry leader.  

If you are a highly skilled Information Technology 
professional utilizing Perl who wants to apply your 
expertise and master emerging technologies while 
earning compensation commensurate with your experience, 
email your resume to the attention of Loren King at:

balacynwyd@edpcs.com

Detailed descriptions available below, or visit our website at:

http://edpcs.com/bin/search.pl?edp403

Job Code:  2583/perl/401
Duration:  3 Months
Position:  Programmer/Analyst
Duties:    Enhance existing applications
Requires:  UNIX, C, Perl  and SQL experience
Location:  Northwest Philadelphia Suburbs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Job Code:  2570/perl/401
Duration:  10 Months
Position:  Programmer / Analyst
Duties:    Develop front end of HR product
Requires:  HTML, JAVA, Oracle Forms 4..5, 
           Perl and UNIX experience
Location:  Center City Philadelphia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Job Code:  2359/perl/401
Duration:  6 Months
Position:  Programmer / Analyst
Duties:    Develop and enhance a 
           document management system
Required:  C, Unix, Perl, RDBMS and SQL experience
Location:  Northwest Philadelphia Suburbs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Job Code:  2142/perl/401
Duration:  3 Months
Position:  Senior Programmer / Analyst
Duties:    Develop a scientific application
Requires:  C and Unix experience, a working 
           knowledge of Perl and a Molecular 
           Biology or similar background.
Location:  Western Philadelphia Suburbs 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Job Code:  1882/perl/401
Duration:  3 Months
Position:  Programmer / Analyst
Duties:    Participate in the development 
           of scientific applications 
Requires:  C and Unix experience 
Location:  Northwest Philadelphia Suburbs 
Note:      Opportunity to pick up on HTML and Perl 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For the past 20 years we have been placing seasoned 
Information Technology professionals in long-term 
consulting contracts with our Fortune 500 client 
companies in the Philadelphia (PA/NJ/DE) area. 
Positions require 2+ years paid professional experience.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please forward your resume to:

Loren King, Technical Recruiting
EDP Contract Services
401 City Ave., Suite 915
Bala Cynwyd, PA 19004
610 667-8735 (fax)     610 667-2990 (voice)
e-mail: balacynwyd@edpcs.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
U.S. Citizenship, Green Card, F-1 or TN eligibility required




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

Date: Tue, 01 Apr 1997 13:21:45 -0600
From: Chris Quaintance <ccq@cs.stanford.edu>
Subject: Perl script for UNIX mail to produce web page?
Message-Id: <859921868.28166@dejanews.com>

Howdy Folks-

Does anyone have a Perl script lying around that can create a
dynamic web page from someone's /var/spool/mail or other
standard flat UNIX mail file?  The idea is to create a
web-accessible archive from a group mailing list.  Am I going
about this completely wrong?

I wanted to see if there are any resources out there before
I start hacking away.

Thanks,
Chris

Chris Quaintance
ccq@cs.stanford.edu

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 01 Apr 1997 19:19:19 +0100
From: Douglas Seay <seay@absyss.fr>
To: Mark C Seigle <mianzo+@cs.cmu.edu>
Subject: Re: Quick Help
Message-Id: <33415FB7.4652@absyss.fr>

Mark C Seigle wrote:
> 
> Hey all!
> 
>         Look, I am new to perl, and I need a quick command that will take a
> scalar or an array and convert it to lowercase.  Subtracting 48 from the
> value, (for all of us old C programmers!), doesn't seem to work.  Any
> help will be grealy appreciated...

48?

I thought 97('a') - 65 ('A') = 32.  Maybe you never were that
good of a C programmer either.  Start with "man perlfunc".

- doug


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

Date: Tue, 01 Apr 1997 14:16:19 -0600
From: Eryq <eryq@enteract.com>
Subject: SOLVED: Who makes more $$, C or Perl programmers?
Message-Id: <33416D13.29CC481B@enteract.com>

Answer: Perl programmers, hands down.  
A recent grep for "$$" in 90 MBs of source code revealed:

	Language	Occurences?
	-------------	-----------------
	C		   0 (*)
	sh/csh		 290
	Perl		3560		
		
(*) In C, the corresponding function is getpaid(), which is
abbreviated on most Unix systems [like creat() and SIGCLD] 
to the name getpid().  So whether you'd rather have lots of $$ or 
simply getpaid() is solely up to you. 

Happy April, everyone.  :-) 
-- 
  ___  _ _ _   _  ___ _   Eryq (eryq@enteract.com)
 / _ \| '_| | | |/ _ ' /  Hughes STX, NASA/Goddard Space Flight Cntr.
|  __/| | | |_| | |_| |   http://www.enteract.com/~eryq
 \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
           |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: Tue, 01 Apr 1997 10:44:51 -0800
From: Devin Ben-Hur <dbenhur@egames.com>
To: Michael Krell <mk2h@clove.cs.Virginia.EDU>
Subject: Re: substituting with /g and simulating "lookbehind"
Message-Id: <334157A3.7F54@egames.com>

[mail&post]
Michael Krell wrote:
> I'm trying to write a regex that will strip out all occurances of the "{"
> character from a string, unless the brace is immediately preceded by a
> backslash.
[snip]
> I'm confused by the second failure case, as illustrated by the code snippet
> below:
> 
> $string="a{{bc";
> print "string is $string\n";
> $string =~ s|([^\\])\{|$1|g;
> print "after substitution, string is $string\n";
> 
> Which prints:
> 
> string is a{{bc
> after substitution, string is a{bc
> 
> Why aren't both braces stripped?
> Can someone explain this?

regexs are "greedy".
When you're at this point in the match:
 a{{bc
 ^
the regex /[^\\]\{/ successfully matches (a matches [^\\], 
{ matches { ), so the substitution occurs and the /g iterates
starting at this position:
 a{{bc
   ^
at which point the regex never matches again so you're
left with 'a{bc' as a result.

I really recommend you read Jeffrey Friedl's book "Mastering 
Regular Expressions" for some insight into these kinds
of problems.

> Can someone help me with a regex that covers these cases?

Here's something I believe will solve your problem:

s{(?xg) # extended form, global substitute
                # first three cases match stuff we want to keep
    ([^\\\{]+)  #  $1 gets one+ non-special-chars
    |           #   or
    \\(\{)      #  $2 gets \-escaped lbrace w/o \
    |           #   or
    (\\.)       #  $3 gets \ followed by any char
    |           # or the one case we want to eliminate:
    \{          #  a literal lbrace (not in parens, so trimmed)
}{$+}; # replace with last matched () group (nil if last case)

> BTW, I'm using ActiveWare's perl for win32 port build 302, based on
> perl 5.003_07.

Me too, amoung others.
The above code worked with several tricky test cases and the 
Win32 beta build.

HTH
--
Devin Ben-Hur      <dbenhur@egames.com>
eGames.com, Inc.   http://www.egames.com/
eMarketing, Inc.   http://www.emarket.com/
"It's better to be lucky than good."  -- Elizabeth Bourne



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

Date: Tue, 1 Apr 1997 14:00:50 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: substituting with /g and simulating "lookbehind"
Message-Id: <ihprh5.u1a.ln@localhost>

Michael Krell (mk2h@clove.cs.Virginia.EDU) wrote:
: I'm trying to write a regex that will strip out all occurances of the "{"
: character from a string, unless the brace is immediately preceded by a
: backslash. 

: My first stab at this is:  $string =~ s|([^\\])\{|$1|g;

: However, this fails in a couple of ways (that I know of).  The first way it
: fails is when the brace is the first character in the string, e.g., "{abc".
: I understand why this fails (there is no match of the pattern since the brace
: is always consumed by the character class).


So give it a zero-length thing to match if it is first in the string:

$string =~ s/(^|[^\\])\{/$1/g;
#             ^
#             ^ match beginning of string

But that still leaves the second problem...


: I'm confused by the second failure case, as illustrated by the code snippet
: below: 

: $string="a{{bc";
: print "string is $string\n";
: $string =~ s|([^\\])\{|$1|g;
: print "after substitution, string is $string\n";

: Which prints:

: string is a{{bc
: after substitution, string is a{bc

: Why aren't both braces stripped?  It's as if the regex engine thinks the
: second brace is at the beginning of the string and is consuming it with the
: character class as in the first failure case.  


That's pretty much it.


: But why should this happen?  


'cause that's the way it works ;-)   see below.


: I
: would expect the substitution to take place, so that the character class
: matches the "a" for the second brace.  Even if the substitution doesn't
: immediately take place, then shouldn't the first brace match the character
: class for the second brace?

: Can someone explain this? 


Yep.

the 'g' gives the pattern match 'state' (ie. it 'remembers' how far
it has already scanned). It picks up from that point for the next
match.

so after the first match it has scanned up to here:

a{{bc
  ^

On the second attempt, it is trying to match '{bc'. Same as the
'beginning of string' case, except the ^ won't match...


: What I really would like to do is simulate a "negative lookbehind" assertion.
: Can someone help me with a regex that covers these cases?


Yep.


--------------------------------------------
#! /usr/bin/perl -w


@strings = (
'a{{bc', '{abc', '{{abc', 'xyz{',
'a{\{bc', '\{abc', '\{{abc', 'xyz\{',
'a\{\{bc'
);

foreach $string (@strings) {
   print "string is $string\n";
   while ($string =~ s/(^|[^\\])\{/$1/) {}         # no 'g', while() instead
   print "after substitution, string is $string\n\n";
}
--------------------------------------------


: BTW, I'm using ActiveWare's perl for win32 port build 302, based on
: perl 5.003_07.


Me no speaky M$...


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Tue, 01 Apr 1997 13:40:09 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: substituting with /g and simulating "lookbehind"
Message-Id: <33416499.1A65D351@gpu.srv.ualberta.ca>

! Michael Krell wrote:
! > I'm trying to write a regex that will strip out all occurances of
the "{"
! > character from a string, unless the brace is immediately preceded by
a
! > backslash.
! [snip]
! > I'm confused by the second failure case, as illustrated by the code
snippet
! > below:
! >
! > $string="a{{bc";
! > print "string is $string\n";
! > $string =~ s|([^\\])\{|$1|g;
! > print "after substitution, string is $string\n";
! >
! > Which prints:
! >
! > string is a{{bc
! > after substitution, string is a{bc
! >
! > Why aren't both braces stripped?
! > Can someone explain this?
! 
! regexs are "greedy".
! When you're at this point in the match:
!  a{{bc
!  ^

[snip]

! > Can someone help me with a regex that covers these cases?
! 
! Here's something I believe will solve your problem:
! 
! s{(?xg) # extended form, global substitute
!                 # first three cases match stuff we want to keep
!     ([^\\\{]+)  #  $1 gets one+ non-special-chars
!     |           #   or
!     \\(\{)      #  $2 gets \-escaped lbrace w/o \
!     |           #   or
!     (\\.)       #  $3 gets \ followed by any char
!     |           # or the one case we want to eliminate:
!     \{          #  a literal lbrace (not in parens, so trimmed)
! }{$+}; # replace with last matched () group (nil if last case)
! 
! > BTW, I'm using ActiveWare's perl for win32 port build 302, based on
! > perl 5.003_07.
! 
! Me too, amoung others.
! The above code worked with several tricky test cases and the
! Win32 beta build.
! 
! HTH

often, when you have a simple case of needing to match
something "not preceeded by" something else, you can use
the poor-man's look behind of simply reversing the string and
using look-ahead, then reversing back. At least the regex
specification can become greatly simplified, and generally
reversing a string is pretty quick:

$string="a{{bc";
print "string is $string\n";
$string=reverse $string;
$string =~ s/{(?!\/)//g;
$string=reverse $string;
print "after substitution, string is $string\n";

regards
andrew


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

Date: Tue, 1 Apr 1997 16:36:35 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: trouble with pipes
Message-Id: <E7ywt1.At@bcstec.ca.boeing.com>

In article <5hee31$4ln$1@nntp2.ba.best.com>,
Tom Vaughan <tommy@best.com> wrote:
 > I guess this is really more a matter of trouble with shells, yet I digress...
 > The following script will not work unless I remove the shbang token, "#!".
 > Is there anyway around this? I would like to leave what constitutes
 > $SHELLSCRIPT unmodified if at all possible.
 > 
 > script follows:
 > 
 > #!/usr/bin/perl
 > 
 > $SHELLSCRIPT = << 'END_OF_SHELLSCRIPT';
 > #!/usr/bin/perl
 > while (<DATA>) {
 >         print $_;
 > }
 > __DATA__
 > one fish
 > two fish
 > blue fish
 > END_OF_SHELLSCRIPT
 > 
 > open(PIPE, "|/bin/sh") || die "unable to open pipe: ";
 > print PIPE $SHELLSCRIPT;
 > close(PIPE);


Feed the shell with perl wrapped in perl:

 ...
$SHELLSCRIPT = << "END_OF_SHELLSCRIPT';
perl <<'END_OF_PERLSCRIPT'
 ...
 ...
END_OF_PERLSCRIPT
END_OF_SHELLSCRIPT
 ....



HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Tue, 01 Apr 1997 19:22:18 GMT
From: posenj@lancet.co.za (Kevin Posen)
Subject: Using Perl with MS-Access
Message-Id: <33425f7e.7192482@news.saix.net>

Hi.

I've been requested to use a Perl CGI script to receive data from an HTML form
and to add this to a database maintained in MS-Access.

I have no idea where to start as I haven't used Access (or any other database
maintenance system) much at all.

Any ideas?

Thanks,
Kevin Posen


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

Date: 31 Mar 1997 21:19:17 GMT
From: 0228462749-0001@t-online.de (Jens Ostermann)
Subject: wherefrom?
Message-Id: <5hp9ol$qcm@news00.btx.dtag.de>

Hi, maybe a stupid question, but

where can i get the sources or a precompiled version of Perl5
for a HP-Unix mashine?

Netscape-search failed.

Thank you, Jens

ostermann@uni-bonn.de


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

Date: 31 Mar 1997 21:15:08 GMT
From: 0228462749-0001@t-online.de (Jens Ostermann)
Subject: wheretoget?
Message-Id: <5hp9gs$ppg@news00.btx.dtag.de>

Maybe a stupid question, but:
Where can i get Perl for a HP-Unix?
Sources or compiled?

Searchin with Netzscape was a fail.

Thank you, Jens

ostermann@uni-bonn.de


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

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

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