[7982] in Perl-Users-Digest
Perl-Users Digest, Issue: 1607 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 9 11:07:18 1998
Date: Fri, 9 Jan 98 08: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 Fri, 9 Jan 1998 Volume: 8 Number: 1607
Today's topics:
Re: bison for perl <jack_h_ostroff@groton.pfizer.com>
Re: C type file #include <barnett@houston.Geco-Prakla.slb.com>
Re: Camel Critiques: PERL: THE PROGRAMMER'S COMPANION <tchrist@mox.perl.com>
Re: Conversion of Floating Point Literal Values (Mike Stok)
Re: Convert .bmp to .jpg via Perl <jdporter@min.net>
Curses, depracated again! <prl2@lehigh.edu>
Re: Curses, depracated again! <prl2@lehigh.edu>
Error Msg using IO::Socket (on NT) as shown in Advanced <deflores@bigfoot.com>
extracting text? David_D._Jones@hud.gov
Re: extracting text? Remove xx to reply xxTony.Curtis@vcpc.univie.ac.at>
Re: File Format Query (Clay Irving)
Re: file glob restrictions?! <jacklam@ulrik.uio.no>
glibc & io_sock test failure ?? <don@marinelab.sarasota.fl.us>
Re: Help: uniq utility <jacklam@ulrik.uio.no>
Re: How to setup IIS to run perl? <dermot@uunet.ca>
Re: Pattern Matching <eike.grote@theo.phy.uni-bayreuth.de>
Re: Pattern Matching <jacklam@ulrik.uio.no>
Re: regex to escape {, } except in TeX commands (Michael Friendly)
Re: Searching text file with perl (Clay Irving)
Re: Server error 500 (I R A Aggie)
Re: Simple array initialisation question <jdporter@min.net>
Re: Simple string length <jdporter@min.net>
Solution Re: Help with passing parameters in URL's plea <vfox@nbnet.nb.ca>
Re: Solution Re: Help with passing parameters in URL's (brian d foy)
Re: Solution Re: Help with passing parameters in URL's <vfox@nbnet.nb.ca>
sorting problem (Tomas)
Re: sorting problem Remove xx to reply xxTony.Curtis@vcpc.univie.ac.at>
substitution <c.forde@qub.ac.uk>
Re: Tech writer lifts burden from programmers <jdporter@min.net>
Re: Telnet client written in perl (I R A Aggie)
Re: Unix perl shell ??? <jdporter@min.net>
Wanted: Perl Contractor, Philly area (Joe Casadonte)
Re: what's wrong? can't match a range of number (Clay Irving)
Re: win32 drive letters <jacklam@ulrik.uio.no>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Jan 1998 09:35:49 -0500
From: "Jack H. Ostroff" <jack_h_ostroff@groton.pfizer.com>
Subject: Re: bison for perl
Message-Id: <34B635C5.2021@groton.pfizer.com>
John Porter wrote:
>
> Well, sure, anyone can make anything available if they want to.
> Is that official enough to be called a "perl distribution"?
>
> > They kind of have to for solaris, as Solaris doesn't bloody come
> > with a C compiler standard! :(
>
> So? As long as gcc is available, you don't need binaries... at least
> for the common unix flavors (including Solaris).
>
> > And they might for Win95 & NT as it is a real pain to try and port
> > stuff from UNIX to Win32...
>
> It makes sense to distribute the binaries for Win32 platforms, because
> they're binary-compatible.
>
> John Porter
> jporter@logicon.com
On many platforms, there are times when you DO need binaries - it's
a bootstrapping problem. GCC is available, but how do you compile it
without a compiler? (whether gcc or native)
------------------------------
Date: Fri, 09 Jan 1998 08:29:19 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: C type file #include
Message-Id: <34B6343F.890C50C0@houston.Geco-Prakla.slb.com>
Reception wrote:
>
> There seems to be no quick answer to this.. so I'm asking the 'group.
>
Actually, there appears to be a quick answer (3rd reference I looked
up). Page 205, Blue Camel, states:
"Note that the file must return true as the last value to indicate
successful execution of any initialization code, so it's customary
to end such a file with 1; unless you're sure it'll return true
otherwise."
Unless I'm missing something, I think that says it all.
> I have a main perl program that will display a menu and run a
> subroutine that is called for by the menu selection. So, being
> familiar with C i decided to put all the subs in different files to
Sounds fair. I did the same, but for different reasons.
> make editing eaiser (for me). I try to require
> "/full/path/to/script"; but I get "fails to return a true value"
> errors on the require line.....
>
You might also want to look into modules, and use, rather than require.
That works well for me (once I found out how to create them. :-) )
> Do I have to put all the code into one honk'n file??
Probably not, but TMTOWTDI. See above.
HTH
Dave
--
"Security through obscurity is no security at all."
-comp.lang.perl.misc newsgroup posting
------------------------------------------------------------------------
* Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------
------------------------------
Date: 9 Jan 1998 14:31:08 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Camel Critiques: PERL: THE PROGRAMMER'S COMPANION
Message-Id: <695cbc$5ds$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
joseph@5sigma.com writes:
:I should amend this comment. I stopped by a bookstore and browsed
:a copy again. Only about 2 minutes, but I decided the layout was
:reasonable. I don't like the single quote characters, but that's minor.
They are simple apostrophes, not vertical primes as so many books
have, which is exactly as many of us see the code. Is there some
problem with that, which I'm unaware of?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
/* This bit of chicanery makes a unary function followed by
a parenthesis into a function with one argument, highest precedence. */
--Larry Wall in toke.c from the perl source code
------------------------------
Date: 9 Jan 1998 10:15:50 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Conversion of Floating Point Literal Values
Message-Id: <695ev6$sf$1@stok.co.uk>
In article <01bd1caa$4cbcc6a0$352914d0@clarke>,
David Clarke <clarked@hunterdon.csnet.net> wrote:
>I am using PERL as an interpreter for another language (similar to
>Assembler).
>This language differentiates data types (floating point, integer). Is there
>any way to
>know from within a subroutine if the argument passed is a floating point
>number which
>is also a whole number? e.g.
>
>sub interpreter {
> $_ = shift;
> print "Floating Point\n" if m/\./;
>}
>
>&interpreter (5.0); # Doesn't work, PERL passes 5, not 5.0
>&interpreter (5.1); # Works OK
>&interpreter ("5.0"); # Also works, but is awkward to use a string for my
>APP
>
>Any help would be appreciated. One of the few hurdles left on the project.
Assuming you're using pelr 5.xxx
You might want to get and play with the Devel::Peek module which lets you
look at what's going on in perl's guts. A brief example in the debugger
will show that perl keeps Integer Values and Number Values for a variable
(amongst other things) and a set of flags which say which of the values
are OK to use. The perlguts manual page and a more advanced perl
book such as Advanced Perl Programming from O'Reilly describe what's going
on, this is just meant to whet your appetite:
DB<1> use Devel::Peek
DB<2> $a = 0.0; $b = 0
DB<3> Dump $a
SV = NV(0x8054918)
REFCNT = 1
FLAGS = (NOK,pNOK)
NV = 0
DB<4> Dump $b
SV = IV(0x80f95e8)
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 0
DB<5> $a = 5.0
DB<6> Dump $a
SV = NV(0x8054918)
REFCNT = 1
FLAGS = (NOK,pNOK)
NV = 5
DB<7> $a = 5
DB<8> Dump $a
SV = PVNV(0x8132218)
REFCNT = 1
FLAGS = (IOK,pIOK)
IV = 5
NV = 5
PV = 0
Modifying your code to:
#!/usr/local/bin/perl -w
use Devel::Peek;
sub interpreter {
$_ = shift;
Dump $_;
}
&interpreter (5);
&interpreter (5.0);
&interpreter (5.1);
&interpreter ("5.0");
might be interesting.
Hope this helps,
Mike
--
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: Fri, 09 Jan 1998 10:19:53 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Convert .bmp to .jpg via Perl
Message-Id: <34B64019.2EE4@min.net>
Eric Hilding wrote:
>
> Does anyone know if a .bmp graphics file can be
> converted to a .jpg format via a perl script?
>
> It may sound bizarre, but such a thing would sure
> eliminate having to manually convert umpteen files
> using a WIN graphics program.
Could certainly be done in Perl.
But depending on your software, converting the files "manually"
may not be onerous. PaintShop Pro, for example, has a
batch convert feature which may fit your requirements.
Alternatively, consider Jef Poskanzer's PBM Plus package,
which can do just about anything you would want to do to an
image, all via pipelineable commands.
------------------------------
Date: 9 Jan 1998 14:15:49 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Curses, depracated again!
Message-Id: <01bd1d09$161f40a0$3e03b480@mm>
Got the following error this morning:
Use of comma-less variable list is deprecated at ./file.pl line
278 (#1)
Here's the code:
...
277 my $mday = (localtime(time))[3];
278 my $mon = (localtime(time))[4];
279 my $year = (localtime(time))[5];
280 my @months = qw(JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC);
281 my $month = $months[$mon];
282 my $date = "${mday}-${month}-${year}";
...
Anyone know what this means? Error isn't in the Blue Camel list. Is there an
on-line list of all error messages?
--
Phil R Lawrence
Systems and Networking Development Services
Programmer/Analyst
prl2@lehigh.edu
------------------------------
Date: 9 Jan 1998 14:31:05 GMT
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: Curses, depracated again!
Message-Id: <01bd1d0b$38648740$3e03b480@mm>
Sorry. Line numbers were confused. problem line was actually:
276 format DEC_REP_TOP =
277 @< Decision Report (dec_rep.lis) for term code: @<<<<<.
278 $dec_codes $term_code
Forgot the comma after $dec_codes.
Phil R Lawrence <prl2@lehigh.edu> wrote (erroneously) in article
<01bd1d09$161f40a0$3e03b480@mm>...
> Got the following error this morning:
> Use of comma-less variable list is deprecated at ./file.pl line
> 278 (#1)
...
------------------------------
Date: Fri, 09 Jan 1998 10:38:05 -0500
From: Deflores <deflores@bigfoot.com>
Subject: Error Msg using IO::Socket (on NT) as shown in Advanced Perl O'Reilly Book
Message-Id: <34B6445D.468D@bigfoot.com>
Using the example code in Advanced Perl, why do I get this error?
use IO::Socket;
$main_sock = new IO::Socket::INET (PeerHost => 'eqnt-020x',
PeerPort => 1200,
Proto => 'tcp',
);
die "Socket couldn't be created. Reason: $!\n" unless $main_sock;#book
#says unless
$sock, which I think is a typo
foreach (1 .. 10) {
print $main_sock "Msg $_: How are you?\n";
}
close ($main_sock);
The error I get is:
IO::Socket::INET: Bad peer address at bigcli.pl line 2
Socket couldn't be created. Reason: Bad file descriptor
No matter what I put in there. The server code works great.
------------------------------
Date: Fri, 09 Jan 1998 09:11:42 -0600
From: David_D._Jones@hud.gov
Subject: extracting text?
Message-Id: <884294092.1668612105@dejanews.com>
I have a text file and I want to extract all the text between two
delimiting markes. There can be any number of lines before and after the
dilimeters. How would I do that? Let'say I have the following text
Line 1
Line 2
aaaaa
Line 3
Line 4
Line 5
aaaaa
Line 6
I want to get the text between the two aaaaa lines. I would think I
could use the /aaaaa(.*)aaaaa/ and that would match Line 3-5. but it
doesn't because the . doesn't match newlines. One solution would be to
replace all \n with some bizzar string and then do the pattern match,
then resubstitute the \n back in. There's got to be a better way?
-David
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 09 Jan 1998 16:40:05 +0100
From: Remove xx to reply xxTony.Curtis@vcpc.univie.ac.at>
To: David_D._Jones@hud.gov
Subject: Re: extracting text?
Message-Id: <7x90spirl5.fsf@vcpc.univie.ac.at>
Re: extracting text?, David <David_D._Jones@hud.gov> said:
David> Line 1
David> Line 2
David> aaaaa
David> Line 3
David> Line 4
David> Line 5
David> aaaaa
David> Line 6
David> I would think I could use the /aaaaa(.*)aaaaa/ and
Look at the "perlre" manpage. See the `s' modifier.
That's probably what you want.
hth,
tony
------------------------------
Date: 9 Jan 1998 09:09:58 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: File Format Query
Message-Id: <695b3m$1fv@panix.com>
In <Pine.GSO.3.96.980108140158.26818l-100000@user2.teleport.com> Tom Phoenix <rootbeer@teleport.com> writes:
>On 8 Jan 1998, tchorzewska wrote:
>> Is it possible to write from perl to a file in .xls format,
>Perl can work with _any_ file format. The real question is whether you
>know the format of the file! :-)
>If there's a module which does what you want, it should be listed in
>the module list on CPAN. If you don't find one to your liking, you're
>welcome and encouraged to submit one! :-) Hope this helps!
> http://www.perl.org/CPAN/
> http://www.perl.com/CPAN/
Try:
LAOLA
http://user.cs.tu-berlin.de/~schwartz/pmh/
The Laola distribution is a collection of documentations and perl
programs dealing with binary file formats of Windows program documents.
LAOLA is giving access to the raw document streams of any program using
"structured storage" technology to save its documents.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Fri, 09 Jan 1998 16:09:42 +0100
From: "Peter J. Acklam" <jacklam@ulrik.uio.no>
Subject: Re: file glob restrictions?!
Message-Id: <34B63DB6.446B@ulrik.uio.no>
Martien Verbruggen wrote:
>
> (...)
> Because globbing invokes a shell, it's often faster to call readdir
> yourself and do your own grep on the filenames.
> (...)
But glob takes a file glob argument and grep takes a regex.
Has anyone written a subroutine/module/whatever that
converts a file glob to a regex?
Peter
------------------------------
Date: Fri, 9 Jan 1998 09:17:09 -0500
From: Don Hayward <don@marinelab.sarasota.fl.us>
Subject: glibc & io_sock test failure ??
Message-Id: <Pine.GSO.3.96.980109091105.19344C-100000@orcinus.mote.org>
I just compiled and installed glibc 2.0.6 . I'm building perl5.004_04.
Check test runs ok to this point and hangs.
lib/io_sock.......IO::Socket::INET: Bad hostname 'localhost'\
...propagated at ./lib/io_sock.t line 59.
I would appriciate any help resolving this. f
Following is output from perl -V for the new build:
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=linux, osvers=2.0.32, archname=i686-linux
uname='linux isurus 2.0.32 #2 sun nov 30 11:20:58 est 1997 i686 '
hint=previous, useposix=true, d_sigaction=define
bincompat3=n useperlio=define d_sfio=undef
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2.3
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=, so=so
useshrplib=true, libperl=libperl.so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/i686-linux/5.00404/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under linux
Compiled at Jan 7 1998 15:45:31
@INC:
/usr/lib/perl5/i686-linux/5.00404
/usr/lib/perl5
/usr/lib/perl5/site_perl/i686-linux
/usr/lib/perl5/site_perl
Thanks.
Don Hayward don@mote.org
Mote Marine Laboratory Voice: 941.388.4441
1600 Ken Thompson Parkway Fax: 941.388.4312
Sarasota, FL 34236 See: http://www.mote.org
Independent, non-profit, marine and estuarine research and education facility.
For PGP public key do: finger don@ajaia.mote.org or http://www.mote.org/~don
require "disclaimer.pl"; # We run Linux
Taxes feed the starving and clothe the naked.
------------------------------
Date: Fri, 09 Jan 1998 15:54:04 +0100
From: "Peter J. Acklam" <jacklam@ulrik.uio.no>
Subject: Re: Help: uniq utility
Message-Id: <34B63A0C.2781@ulrik.uio.no>
See
perlfaq4
section
"How can I extract just the unique elements of an array?"
Peter
------------------------------
Date: Fri, 9 Jan 1998 10:00:39 -0500
From: "Dermot K. Pope" <dermot@uunet.ca>
Subject: Re: How to setup IIS to run perl?
Message-Id: <695eaf$4ov$1@nntp1.uunet.ca>
If you are running NT 4.0 do the following:
In the registry find W3SRV under the "CurrentControlSetting"
select 'parameters' ... select 'scriptmapping'
add .pl c:\bin\perl5\bin\perl.exe %s as a value or
add .cgi <same as above>
Your perl binaries are mostly likely in a different place so make sure the
path is right. Also, you might want to use Perlls.dll (runs more
efficiently...but a few restrictions exist)
As for the registry keys .. I'm not sure if I remember the exact
spelling(its been a while), but you get the idea.
----------------------------------------------------------
Dermot Pope, Senior Product Developer
Hosting Services - UUNET-CA
Tel: (416) 216-5119 +1 800 463 8123 x5119
dermot@uunet.ca or pope@sprint.ca
Samuel Shum wrote in message <694p23$m071@hkpa05.polyu.edu.hk>...
>Hello,
> I am new to "Perl" and I have some ".pl" files to run on NT. I got an
>error "Not supported" from the IIS. Did I miss something? I have heard that
>I need a "Perl for Win32" to run on my server. After I installed it, the
>server still gives me the same error message. How can I configure my IIS to
>work with perl? Thanks in advance.
>
>--
>BR,
>Samuel
>
>================================
>Samuel Shum
>Multimedia Production Centre
>The Hong Kong Polytechnics University
>Email: itsam@polyu.edu.hk
>Homepage: www.polyu.edu.hk/mpc
>
>
>
------------------------------
Date: Fri, 09 Jan 1998 14:33:35 +0100
From: Eike Grote <eike.grote@theo.phy.uni-bayreuth.de>
Subject: Re: Pattern Matching
Message-Id: <34B6272F.446B@theo.phy.uni-bayreuth.de>
Hi,
Andie Crossland wrote:
>
> I am trying to pattern match a string e.g.
>
> "This is a \"perl\" script"
>
> Is this possible to do it in one pattern match?
> I can only think of
>
> m/"[^"]*"/
>
> but this will only match
> "This is a \"
But what you really want is "This is a \"perl\" script" , right ?
One idea: search the string _backwards_ using the so-called negative
lookahead assertion (described on the 'perlre' manual page). In plain
words: look for a '"' which is not followed by a '\'.
Code example:
#!/usr/local/bin/perl -w
$s = '----"This is a \"perl\" script"----';
### step by step
$temp = reverse($s); # turn round string
$temp =~ m/".*?"(?!\\)/; # search
$t = reverse($&); # turn around match
### a one-liner
$t = reverse( ( reverse($s) =~ m/(".*?"(?!\\))/ )[0] );
>
> Can this be done?
Everything can be done in Perl ... hm, almost ... ;-)
Bye, Eike
--
=======================================================================
>>--->> Eike Grote <eike.grote@theo.phy.uni-bayreuth.de> <<---<<
-----------------------------------------------------------------------
Home Page, Address, PGP,...: http://www.phy.uni-bayreuth.de/~btpa25/
-----------------------------------------------------------------------
PGP fingerprint: 1F F4 AB CF 1B 5F 4B 1D 75 A1 F9 C5 7B 3F 37 06
=======================================================================
------------------------------
Date: Fri, 09 Jan 1998 16:30:05 +0100
From: "Peter J. Acklam" <jacklam@ulrik.uio.no>
Subject: Re: Pattern Matching
Message-Id: <34B6427D.15FB@ulrik.uio.no>
Richard Caley wrote:
>
> In article <eq1hMxPH9GA.270@upnetnews02.moswest.msn.net>, Andie Crossland (ac) writes:
>
> ac> I am trying to pattern match a string e.g.
> ac> "This is a \"perl\" script"
>
> I think:
>
> m/"((\\")|[^"])*"/
For more details, including an optimized version,
see "Mastering Regular Expressions" by J. Friedl
(http://www.ora.com/catalog/regex/).
Peter
------------------------------
Date: 9 Jan 1998 13:52:19 GMT
From: friendly@hotspur.psych.yorku.ca (Michael Friendly)
Subject: Re: regex to escape {, } except in TeX commands
Message-Id: <695a2j$pkv$1@sunburst.ccs.yorku.ca>
In article <6911g2$dqv$1@sunburst.ccs.yorku.ca>
friendly@hotspur.psych.yorku.ca (Michael Friendly) writes:
|I need a regex to escape braces, {}, translating them to \{, \},
|except when they are part of a TeX command like \texttt{stuff}.
Had several replies, but perhaps I didn't specify the problem clearly
enough.
I'd be willing to accept that the TeX commands would not be nested.
What I actually want to do is to process code lines that may contain tex
commends in comments:
table = { 1 2, 3 4}; /* see Figure~\ref{fig:one} */
to
table = \{ 1 2, 3 4\}; /* see Figure~\ref{fig:one} */
so, I want to avoid escaping { and } when it occurs in the
pattern
\[a-zA-Z]+{[^}]+}
The { } in the code can actually extend over more than one line,
table = { 1 2, /* see Figure~\ref{fig:one} */
3 4};
but I'd be willing to specify that the TeX commands cannot.
Does this make it easier?
--
Michael Friendly Internet: friendly@hotspur.psych.yorku.ca (NeXTmail OK)
Psychology Dept
York University Voice: 416 736-5118 Fax: 416 736-5814
4700 Keele Street http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT M3J 1P3 CANADA
------------------------------
Date: 9 Jan 1998 09:22:17 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Searching text file with perl
Message-Id: <695bqp$2be@panix.com>
In <884175871.1373503501@dejanews.com> ecsspear@livjm.ac.uk writes:
>I am trying to get a perl script that will search a text file on the web
>for a keyword then return that part of the text file with the results.
>Eg - I am searching a list of e-mail addressess for the keyword 'brian' -
>I expect it to return
>brian@wibble.com
>g.rbrian@smith.com
>pete@briany.com
>etc
>etc
>Does anyone know how I can do this - I have tried botching site search
>scripts but they all just return file names :(
Eh?
Could it be a simple as:
#!/usr/local/bin/perl5.00403 -w
while (<DATA>) {
chomp;
if (/brian/) {
print "I found \"brian\" in this: $_\n";
}
}
__DATA__
clay@panix.com
joe_schmo@frobwitz.com
brian@wibble.com
g.rbrian@smith.com
pete@briany.com
president@whitehouse.gov
The program prints:
I found "brian" in this: brian@wibble.com
I found "brian" in this: g.rbrian@smith.com
I found "brian" in this: pete@briany.com
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Fri, 09 Jan 1998 09:58:46 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Server error 500
Message-Id: <fl_aggie-0901980958460001@aggie.coaps.fsu.edu>
In article <ehXMmNNH9GA.172@upnetnews02.moswest.msn.net>, "Ken"
<turboman34@hotmail.com> wrote:
+ Error: HTTPd: malformed header from script /cgi-bin/greeting.pl
Does the script send out a proper Content-Type: header _before_
it send anything else to STDOUT???
James - I suspect the answer is a resounding NO!
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Fri, 09 Jan 1998 10:43:49 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Simple array initialisation question
Message-Id: <34B645B5.3FBE@min.net>
Remove, xx, to, reply, xxTony.Curtis@vcpc.univie.ac.at> wrote:
>
> splitter!
Are you referring to the Judaean Popular People's Front, or...?
------------------------------
Date: Fri, 09 Jan 1998 10:26:43 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Simple string length
Message-Id: <34B641B3.2AE2@min.net>
Martien Verbruggen wrote:
>
> $cnt = $string =~ tr/0-9//; # count the digits in $string
Ok, but why destroy the string? Replace each digit with itself:
$cnt = $string =~ tr/0-9/0-9/;
------------------------------
Date: Fri, 9 Jan 1998 10:32:58 -0400
From: "Vaughn Fox" <vfox@nbnet.nb.ca>
Subject: Solution Re: Help with passing parameters in URL's please
Message-Id: <695d0q$kpo$1@usenet50.supernews.com>
In case anyone is interested I stumbled onto a solution today for my problem
with spaces in file names. By changing the URL parameter from
http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/another test
to
http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/anothe~1
It'll work like a charm. In other words any filename with a space should be
truncated at 6 characters and add ~1 to the end of the filename, and it
works fine.
This has caused me TONS of grief, hope it'll save someone else some.
Vaughn Fox wrote in message <68r29p$rr0$1@usenet76.supernews.com>...
>Hi
>
>I'm running IIS 3.0 on an NT 4.0 platform using IE 4.0 as a browser. I'm
>having the following problem with a script I've developed. Any help would
>be GREATLY appreciated.
>
------------------------------
Date: Fri, 09 Jan 1998 10:02:22 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Solution Re: Help with passing parameters in URL's please
Message-Id: <comdog-0901981002220001@news.panix.com>
Keywords: just another new york perl hacker
In article <695d0q$kpo$1@usenet50.supernews.com>, "Vaughn Fox" <vfox@nbnet.nb.ca> posted:
> In case anyone is interested I stumbled onto a solution today for my problem
> with spaces in file names. By changing the URL parameter from
>
> http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/another test
>
> to
>
> http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/anothe~1
>
> It'll work like a charm. In other words any filename with a space should be
> truncated at 6 characters and add ~1 to the end of the filename, and it
> works fine.
what happens if one has the files "another file" and "another file2"?
this seems to have nothing to do with URL's and everything to do
with some wierd operating system thing...
--
brian d foy <http://computerdog.com>
------------------------------
Date: Fri, 9 Jan 1998 11:21:46 -0400
From: "Vaughn Fox" <vfox@nbnet.nb.ca>
Subject: Re: Solution Re: Help with passing parameters in URL's please
Message-Id: <695feh$icv$1@usenet40.supernews.com>
You'd have to increment the filena~1 to filena ~2 same as you would with
DOS.
Confusing as hell, but it works
brian d foy wrote in message ...
>In article <695d0q$kpo$1@usenet50.supernews.com>, "Vaughn Fox"
<vfox@nbnet.nb.ca> posted:
>
>> In case anyone is interested I stumbled onto a solution today for my
problem
>> with spaces in file names. By changing the URL parameter from
>>
>> http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/another
test
>>
>> to
>>
>> http://server/bin/index1.pl?%20../Intranet/testarea/Accounting/anothe~1
>>
>> It'll work like a charm. In other words any filename with a space should
be
>> truncated at 6 characters and add ~1 to the end of the filename, and it
>> works fine.
>
>what happens if one has the files "another file" and "another file2"?
>this seems to have nothing to do with URL's and everything to do
>with some wierd operating system thing...
>
>--
>brian d foy <http://computerdog.com>
------------------------------
Date: Fri, 09 Jan 1998 15:42:28 GMT
From: tomas@iimagers.com (Tomas)
Subject: sorting problem
Message-Id: <695gi9$c21$1@gte2.gte.net>
I was wondering if someone could help me out here...I am trying to
find a way to sort @menu alphabetically by last names. @menu typically
looks like this:
@menu[0] = "Smith, John [73301]";
@menu[1] = "Doe, John [06102]";
@menu[2] = "Smith, Lisa [02133]";
@menu[3] = "Lee, Jane [34504]";
@menu[4] = "Lewis, Joe [07135]";
...
Many thanks in advance.
Tomas
------------------------------
Date: 09 Jan 1998 16:52:05 +0100
From: Remove xx to reply xxTony.Curtis@vcpc.univie.ac.at>
To: tomas@iimagers.com
Subject: Re: sorting problem
Message-Id: <7x67ntir16.fsf@vcpc.univie.ac.at>
Re: sorting problem, Tomas <tomas@iimagers.com> said:
Tomas> I was wondering if someone could help me out here...I
Tomas> am trying to find a way to sort @menu alphabetically
Tomas> by last names. @menu typically looks like this:
I think that should be
$menu[0] = "Smith, John [73301]";
etc.
Doesn't `sort' just do what you want by default?
$menu[0] = "Smith, John [73301]";
$menu[1] = "Doe, John [06102]";
$menu[2] = "Smith, Lisa [02133]";
$menu[3] = "Lee, Jane [34504]";
$menu[4] = "Lewis, Joe [07135]";
@sorted_menu = sort @menu;
print join("\n", @sorted_menu) . "\n";
==>
Doe, John [06102]
Lee, Jane [34504]
Lewis, Joe [07135]
Smith, John [73301]
Smith, Lisa [02133]
Or am I missing something here?
hth,
tony
------------------------------
Date: Fri, 09 Jan 1998 15:21:25 +0000
From: Colin Forde <c.forde@qub.ac.uk>
Subject: substitution
Message-Id: <34B64075.142B@qub.ac.uk>
Hi all
A wee perl quickie. Im a newbie.
Ive read a file of information into an array and would like to scan each
line read and replace a string of the type sample@some.machine.somewhere
with another email address read in as a string into variable $email.
ie
substitute/sample@some.machine.somewhere/contents of $email/
Thanks
Please email me.
c.forde@qub.ac.uk
--
________________________________________________________________
C.Forde@queens-belfast.ac.uk phone : +44 (0)1232 245133 x3950
fax : +44 (0)1232 230592
------------------------------
Date: Fri, 09 Jan 1998 10:39:06 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Tech writer lifts burden from programmers
Message-Id: <34B6449A.1A84@min.net>
Not too long ago I wrote:
>
> confustion.
Typo. I meant "confustation".
> Even with style guides, modern writers
Whoops -- guess my stream of consciousness ran dry.
------------------------------
Date: Fri, 09 Jan 1998 09:56:32 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Telnet client written in perl
Message-Id: <fl_aggie-0901980956330001@aggie.coaps.fsu.edu>
In article <34B4DFDD.7900@fccj.cc.fl.us>, bill@astro.fccj.cc.fl.us wrote:
+ Will this Telnet client need to operate independently of it's
+ user/program?
+ If so, then I would recommend looking at http://expect.nist.gov
Ummm...why? I would recommend the perl module Net::Telnet.
James
--
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>
------------------------------
Date: Fri, 09 Jan 1998 10:14:34 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Unix perl shell ???
Message-Id: <34B63EDA.5D53@min.net>
Ed Avis wrote:
>
> ... write an "automatic responder" for this kind of message:
> Scan the Perl FAQ for a section which roughly matches the question
> posted, and automatically reply to the newsgroup with a reference to
> that section.
Ok, but maybe better to respond by email instead.
Rather like a flamebot. A rtfmbot? (rt-fembot!)
------------------------------
Date: 9 Jan 1998 14:25:41 GMT
From: joc@netaxs.com (Joe Casadonte)
Subject: Wanted: Perl Contractor, Philly area
Message-Id: <695c15$g83@netaxs.com>
Philadelphia, PA area company looking for a Perl contractor for 3-4
month contract, starting immediately. Remote development a
possibility, but local contractor is defintely preferred.
Project involves construction of multi-platform (UNIX and WinNT)
installation script, fairly complex. Final script must be
well-commented and extensible. Large project Perl experience needed;
we'll provide the requirements, but design and implementation is up to
you.
Please send resume and contact info to me in plain text, MS-Word or HTML
format.
Regards,
joe
joc@netaxs.com
------------------------------
Date: 9 Jan 1998 08:50:52 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: what's wrong? can't match a range of number
Message-Id: <6959vs$a6@panix.com>
In <34B4E63B.5405C5F0@haas.berkeley.edu> Patience <feng@haas.berkeley.edu> writes:
>Hi guys,
There are a few girls also.
>My script will validate user's birthday in format of 11/22/77 or
>11/22/1977. I don't know why my code does not work.
>if ($Pair{Birthday} != /(1..12)\/(1..31)\/(0..1986)/)
>{
> &Reject ('You had made a typo in your birthday. The format must
>be similar to 11/30/76 or 11/30/1976');
>}
Others told you why it doesn't work. I'll just tell you:
Perl Modules are your friend.
#!/usr/local/bin/perl -w
use Date::DateCalc qw(leap);
while (DATA>) {
chomp;
($month, $day, $year) = split /\//;
if (check_date($year, $month, $day)) {
print "$_ is a valid date.\n";
} else {
print "$_ is not a valid date.\n";
}
}
__DATA__
02/30/97
04/01/97
12/20/97
12/31/97
prints:
02/30/97 is not a valid date.
04/01/97 is a valid date.
12/20/97 is a valid date.
12/31/97 is a valid date.
--
Clay Irving <clay@panix.com> I think, therefore I am. I think?
http://www.panix.com/~clay/
------------------------------
Date: Fri, 09 Jan 1998 16:23:28 +0100
From: "Peter J. Acklam" <jacklam@ulrik.uio.no>
Subject: Re: win32 drive letters
Message-Id: <34B640EF.794B@ulrik.uio.no>
Alastair Rae wrote:
>
> Is there a way to get a list of drive letters on a win32 system?
> Eg it might return something like ( 'a:', 'c:', 'd:', 'e:' ).
I don't have a Win32 machine here, so this is untested.
I think this should work, though
@drives = grep( -e "$_:\\", "a" .. "z" );
It does not include the trailing colon, but I guess you can fix
that. To see if a drive exists, I would try
-e "$drive\\"
For instance,
$drive = "d:"; # Or whatever
print "Drive exists!\n" if -e "$drive\\";
Peter
------------------------------
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 1607
**************************************