[10742] in Perl-Users-Digest
Perl-Users Digest, Issue: 4341 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 2 11:07:25 1998
Date: Wed, 2 Dec 98 08:00:20 -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 Wed, 2 Dec 1998 Volume: 8 Number: 4341
Today's topics:
AAH Re: How to use Perl-script as filter? <k.molkenthin@amdiv.de>
DB_File under perl5.003 michela@thequality.com
decimal to binary <ayoung@sigg.com>
Re: How to use Perl-script as filter? <zenin@bawdycaste.org>
Re: How to use Perl-script as filter? (Karlon West)
Re: interface to IBM's MQ Series <bridgett@uk.ibm.com>
is it possible to use perl for win as a CGI (g l e n r a m s e y)
Re: is it possible to use perl for win as a CGI <bprater@jipes.com>
Keys,Values(Associative Arrays) <anagaraj@eccms1.dearborn.ford.com>
Re: Learning if Variable is array (Abigail)
Re: localtime () - perl's bug ? (Greg Bacon)
Perl and FTP 'rcmd' command or 'quote rcmd' (Charles Wilt)
Re: Perl and FTP 'rcmd' command or 'quote rcmd' (Jeffrey R. Drumm)
Re: Perl binary manipulation (Steffen Beyer)
Re: Perl binary manipulation <newspost@morlock.net>
Re: Perl compiler? (Can you get one?) <marius@funcom.com>
Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)? ( hans mayer )
Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)? <alex@srce.hr>
Re: Perl Script to take data off a form and post it to <bprater@jipes.com>
Re: problem with \ifthenelse inside tabularx <Tony.Curtis+usenet@vcpc.univie.ac.at>
substitution and spacing mbrennan@observera.com
Re: substitution and spacing <jdf@pobox.com>
Re: substitution and spacing <jmp35@cornell.edu>
Trim Functionality ?? <sunilk@mahindrabt.com>
Re: Trim Functionality ?? <bprater@jipes.com>
Re: win32API module available for Unix? (Bbirthisel)
XS / C++ and the 'simple' example CCsimple - HELP! <priceh@ms.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Dec 1998 15:53:42 +0100
From: Kay Molkenthin <k.molkenthin@amdiv.de>
Subject: AAH Re: How to use Perl-script as filter?
Message-Id: <36655476.E3E52F1D@amdiv.de>
> : Q2: How do I redirect the input?
>
> Like you would any other program (sed, grep, etc). See man vi for
> details about sending the text buffer through a filter program.
I know how to make a pipe command!
I need to fetch the text from vi into my skript. That has to be
something like:
open (IN, <STDIN>); ?Correct???
Read it into an array
close (IN);
Do something with the text in the array:
Print ???? the array back again to <STDOUT> ???
print <STDOUT> @array
That was the question - not how do i invoke the piping.
Questions are:
1. How do I read the input stream?
2. Where do I put the output into?
Kay.
------------------------------
Date: Wed, 02 Dec 1998 14:46:06 GMT
From: michela@thequality.com
Subject: DB_File under perl5.003
Message-Id: <743jrd$mpo$1@nnrp1.dejanews.com>
Has anyone ever got DB_File to compile under perl5.003? Yes, I know it is
unsupported but please shoot management, not the messenger.
Thanx,
.M.
--
---------------------------------------------------------------------
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 02 Dec 1998 09:43:33 -0600
From: Aaron Young <ayoung@sigg.com>
Subject: decimal to binary
Message-Id: <36656025.9129B987@sigg.com>
I'm sure this has more to do with my misunderstanding of the
documentation than anything else
but
I am just not understanding what I've read, so I come to CLPM for
clarification
How would one convert 7 to 00000111?
or even 00000000000000000000000000000111
granted, I do not have a lot of experience with binary representations
of decimals, but I need to be able to convert back and forth between the
two
I know it has something to do with the pack operator (or at least I
believe it does) but I'm not getting out of the docs what it probably
glaringly obvious
assistance is appreciated
Aaron
------------------------------
Date: 02 Dec 1998 14:02:57 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: How to use Perl-script as filter?
Message-Id: <912607436.874611@thrush.omix.com>
Kay Molkenthin <k.molkenthin@amdiv.de> wrote:
: I need to modify a text, I write in vi (my standard editor). After
: writing the text i want to pipe it through this script and want the
: modified text in vi instead of the old one.
:
: Q1: Is this possible?
Yes.
: Q2: How do I redirect the input?
Like you would any other program (sed, grep, etc). See man vi for
details about sending the text buffer through a filter program.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 2 Dec 1998 14:07:44 GMT
From: karlon@bnr.ca (Karlon West)
Subject: Re: How to use Perl-script as filter?
Message-Id: <743hjg$4vo$1@crchh14.us.nortel.com>
Kay Molkenthin (k.molkenthin@amdiv.de) wrote:
> Hi,
> I need to modify a text, I write in vi (my standard editor). After
> writing the text i want to pipe it through this script and want the
> modified text in vi instead of the old one.
> Q1: Is this possible?
yes.
> Q2: How do I redirect the input?
1) Move the cursor to the top of the file: "1G" in cmd mode
2) Pipe-replace the whole file: "!Gperl-script-name" in cmd mode
> Kay.
------------------------------
Date: 02 Dec 1998 14:33:54 +0000
From: Adrian Bridgett <bridgett@uk.ibm.com>
Subject: Re: interface to IBM's MQ Series
Message-Id: <tb5soey7gvh.fsf@bridgett.hursley.ibm.com>
pap4628@cisyellow.carenet.org (Paul A. Palmer) writes:
> Well, I have searched CPAN, as well as the MQ Series home page, but if it's
> there I missed it.
>
> Does there exist a Perl interface to IBM's MQ Series?
>
> I have something called PLMQ.pm, but it's version 1.00, dated 17-Apr-1997, and
> I cannot find any traces of later versions. And mail to the author bounces. So
> it looks pretty dead.
All the supportpacks are at:
http://www.software.ibm.com/ts/mqseries/txppacs/txpm2.html
MA85: MQSeries perl language interface, 20Apr98
Enjoy
Adrian
--
Adrian Bridgett <bridgett@hursley.ibm.com>
Internal: 7-245528 External: 01962-815528
------------------------------
Date: Wed, 02 Dec 1998 14:28:02 GMT
From: glen@perfectday.com (g l e n r a m s e y)
Subject: is it possible to use perl for win as a CGI
Message-Id: <36654d6b.19710570@news.easynet.co.uk>
if so can someone enlighten me :-)
i can quite happily use perl in my "batch files", i simply can't use
them through a browser as a CGI
(i'm using PWS under windows95 --well, actually ''98, ut don't tell
anyone)
thanks
~glen.
------------------------------
Date: Wed, 2 Dec 1998 09:30:13 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: is it possible to use perl for win as a CGI
Message-Id: <36655c81.0@news.mediacity.com>
Glen,
I've never been quite successful with PWS. Grab a copy of Xitami at
tucows.com and everything should work all 'hunky-dorey'.
Ben
g l e n r a m s e y wrote in message
<36654d6b.19710570@news.easynet.co.uk>...
>if so can someone enlighten me :-)
>
>i can quite happily use perl in my "batch files", i simply can't use
>them through a browser as a CGI
>
>(i'm using PWS under windows95 --well, actually ''98, ut don't tell
>anyone)
>
>thanks
>
>~glen.
------------------------------
Date: Wed, 02 Dec 1998 10:02:59 -0500
From: Ashwini Nagaraj <anagaraj@eccms1.dearborn.ford.com>
Subject: Keys,Values(Associative Arrays)
Message-Id: <366556A3.57A234B2@eccms1.dearborn.ford.com>
Hi All,
I am using DBI in my perl script and when I do a query as shown below,
how can I save the results in an associative array as keys and values.
For ex if my query looks like:
"Select ex.server, ex.metric, ex.value from db.table ex
where ex.metric = xxxxxxxxxx or ex.metric = aaaaaaaaaaaaa
group by ex.server"
I am farely new to this subject, please help me out here. I would
appreciate if anyone could post me any example of the same type.
Thanks
Ashwini
------------------------------
Date: 2 Dec 1998 15:38:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Learning if Variable is array
Message-Id: <743msq$590$1@client3.news.psi.net>
Nate Blaylock (blaylock@cs.byu.edu) wrote on MCMXIX September MCMXCIII in
<URL:news:Pine.HPP.3.96.981201175048.7976A-100000@niue.cs.byu.edu>:
++ Hello all,
++
++ I'm a newbie, so forgive my (probably) simple question.
++
++ Is there some sort of function that will tell me if a variable is an array
++ or a scalar?
No.
Just to write down the variable, you need to know whether it's scalar
or array.
Abigail
------------------------------
Date: 2 Dec 1998 15:43:11 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: localtime () - perl's bug ?
Message-Id: <743n6f$mg$1@info.uah.edu>
In article <yl90gwvfrk.fsf@windlord.stanford.edu>,
Russ Allbery <rra@stanford.edu> writes:
: No, it's documented. The documentation says why this is. See man
: perlfunc under localtime.
What about more reasonable gmtime() and localtime()?
package XLocaltime;
use strict;
use vars qw( @ISA @EXPORT @EXPORT_OK );
require Exporter;
@ISA = qw( Exporter );
@EXPORT = ();
@EXPORT_OK = qw( xlocaltime xgmtime );
sub xlocaltime {
my $arg = @_ ? shift : time;
if (wantarray) {
my @tmx = localtime $arg;
$tmx[4]++; # month
$tmx[5] += 1900; # year
return @tmx;
}
else {
return localtime $arg;
}
}
sub xgmtime {
my $arg = @_ ? shift : time;
if (wantarray) {
my @tmx = gmtime $arg;
$tmx[4]++; # month
$tmx[5] += 1900; # year
return @tmx;
}
else {
return gmtime $arg;
}
}
1;
__END__
Greg
--
I worry that the person who thought up "Muzac" may be thinking up something
else.
-- Lily Tomlin
------------------------------
Date: 2 Dec 1998 14:29:31 GMT
From: charles.0272@worldnet.no.spam.att.net (Charles Wilt)
Subject: Perl and FTP 'rcmd' command or 'quote rcmd'
Message-Id: <MPG.10cf1c59a84a98f6989689@netnews.worldnet.att.net>
I currently use Win95/NT ftp client with -s option in a batch file to
automate ftp transfers. However, I'm looking for something with a little
more power. Particularly, I will have one or more files that I need to
transfer. I need to be able to find out the name of the file, start an
ftp session, transfer the file(s) and last but not least, run a host
command using an ftp subcommand of 'rcmd'. Using the MS client I have to
use 'quote rcmd' but that works fine.
Now, I was looking at Perl, thinking that it would have everything I
need. So far I've been unable to find a Perl module that implemented the
quote or the rcmd...am I missing it somewhere or does it not exist?
Note: I downloaded the binary of Perl version for Win32 from the
www.perl.com site.
Thanks for the help,
--
Charles Wilt
e-mail: charles.0272@worldnet.no.spam.att.net
--->remove the no.spam.
------------------------------
Date: Wed, 02 Dec 1998 15:02:25 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Perl and FTP 'rcmd' command or 'quote rcmd'
Message-Id: <3665553b.1351393@news.mmc.org>
[ posted to comp.lang.perl.misc and a courtesy copy was NOT mailed to the cited
author because of munged mail address ]
On 2 Dec 1998 14:29:31 GMT, charles.0272@worldnet.no.spam.att.net (Charles
Wilt) wrote:
>I currently use Win95/NT ftp client with -s option in a batch file to
>automate ftp transfers. However, I'm looking for something with a little
>more power. Particularly, I will have one or more files that I need to
>transfer. I need to be able to find out the name of the file, start an
>ftp session, transfer the file(s) and last but not least, run a host
>command using an ftp subcommand of 'rcmd'. Using the MS client I have to
>use 'quote rcmd' but that works fine.
>
>Now, I was looking at Perl, thinking that it would have everything I
>need. So far I've been unable to find a Perl module that implemented the
>quote or the rcmd...am I missing it somewhere or does it not exist?
>
>Note: I downloaded the binary of Perl version for Win32 from the
>www.perl.com site.
>
>Thanks for the help,
The Net::FTP module provides a quot() method, and is included in the libnet
distribution. If you downloaded the GSAR port of 5.004_02, you probably already
have it. I did encounter some anomalies with that version of libnet, though,
and have since switched to the ActiveState Perl 5.005_02 build 507 (you must
install libnet separately via ppm). No problems to report so far.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: 2 Dec 1998 14:21:07 GMT
From: sb@engelschall.com (Steffen Beyer)
Subject: Re: Perl binary manipulation
Message-Id: <743icj$b4b$1@en1.engelschall.com>
Kevin Wormington <kworm@sofnet.com> wrote:
> Hi, I am fairly new to perl and am trying to extract fields from a binary
> field that has the layout below. I have managed to get the field converted
> to binary padded to 32bits using pack("N") and viewed in binary via unpack
> ("B32"), but when I try to use something like unpack("B3B5B3B4B1B6B10") it
> seems to stop on the singe bit designated B1. Can anyone provide any hints
> on how to extract this info?
> Thanks
> Kevin
> 31-29 Reserved
> 28-24 Type field (Currently unused)
> 23-21 Chassis field
> 20-17 Slot field
> 16 PM field
> 15-10 Link field
> 9-0 Channel field
Perl modules are your friend.
The module "Bit::Vector" is ideally suited for bit extractions as in your
example.
See the method "Chunk_Read()" in the documentation which allows you to
extract arbitrary fields of bits.
The module is available from
http://www.engelschall.com/u/sb/download/
http://www.perl.com/CPAN/authors/id/STBEY/
Hope this helps.
Regards,
--
Steffen Beyer <sb@engelschall.com>
Free Perl and C Software for Download:
http://www.engelschall.com/u/sb/download/
New: Build'n'Play 2.1.0 (all-purpose Unix batch installation tool)
------------------------------
Date: Wed, 2 Dec 1998 10:38:00 -0500
From: "Steven Morlock" <newspost@morlock.net>
Subject: Re: Perl binary manipulation
Message-Id: <_bd92.21$4g2.221437@lwnws01.ne.mediaone.net>
This appears to be something undocumented with how unpack
handles bit strings. Each bit string specifier starts on
the next whole byte. In the case of your template it would
only respect the first four bit string specifiers being
used which totals 15 bits returned.
The bit of perl:
while (<>)
{
my $raw = pack("N",$_);
print " bits: 01234567890123456789012345678901\n";
my $bin = unpack("B32",$raw);
print " bin: $bin\n";
my ($b1,$b2,$b3,$b4,$b5,$b6,$b7) = unpack("B3B5B3B4B1B6B10",$raw);
print "parts: $b1$b2$b3$b4$b5$b6$b7\n";
print "parts: ", substr($b1 . " " x 8, 0, 8), substr($b2 . " " x 8, 0, 8),
substr($b3 . " " x 8, 0, 8), substr($b4 . " " x 8, 0, 8), "\n";
}
given the input '1234567890' produces:
bits: 01234567890123456789012345678901
bin: 01001001100101100000001011010010
parts: 010100100001101
parts: 010 10010 000 1101
Note that only 15 bits are returned and the values in
the bit strings correspond to the start of the bytes
in the long word.
This test was run on:
version 5.005_02 built for MSWin32-x86-object
I couldn't find anything in the FAQs/DJN covering this
behavior. Is it noted anywhere?
Steve
--
Foliage Software Systems
aka The Nerd Farm
http://www.foliage.com
Ken McNamara wrote in message <36653151.E0E7B7DF@tcon.net>...
>Kevin -
>
>Try the bit shift operators: "<< or >>". You can extract just the parts of
>the number you are interested in and reduce the confusion.
>
>KenMc
>
>Kevin Wormington wrote:
>
>> Hi, I am fairly new to perl and am trying to extract fields from a binary
>> field that has the layout below. I have managed to get the field converted
>> to binary padded to 32bits using pack("N") and viewed in binary via unpack
>> ("B32"), but when I try to use something like unpack("B3B5B3B4B1B6B10") it
>> seems to stop on the singe bit designated B1. Can anyone provide any hints
>> on how to extract this info?
>>
>> Thanks
>> Kevin
>>
>> 31-29 Reserved
>> 28-24 Type field (Currently unused)
>> 23-21 Chassis field
>> 20-17 Slot field
>> 16 PM field
>> 15-10 Link field
>> 9-0 Channel field
>>
>> Translate 1041 to binary :
>>
>> 10000010001
>>
>> Pad to 32 bits :
>>
>> 00000000000000000000010000010001
>>
>> Separate the fields by a space :
>>
>> 000 00000 000 0000 0 000001 0000010001
>
>
>
------------------------------
Date: Wed, 02 Dec 1998 16:22:48 +0100
From: Marius Kjeldahl <marius@funcom.com>
Subject: Re: Perl compiler? (Can you get one?)
Message-Id: <36655B48.9302A523@funcom.com>
Martien Verbruggen wrote:
>
> In article <740jil$3sl$1@nclient3-gui.server.ntli.net>,
> Aidan Rogers <aidan@salvador.blackstar.co.uk> writes:
> > After all these replies, I have a related question. Is it possible to get a
> > compiler for Perl? It's all very well having a script that will run fine on
> > any system that has Perl installed on it, but is it possible to compile to
> > a binary executable?
>
> # perldoc perlfaq5
> # perldoc -q compile
> [snip]
> =head1 Found in /usr/local/lib/perl5/5.00502/pod/perlfaq3.pod
>
> =head2 How can I compile my Perl program into byte code or C?
What the faq does not say is that the compiler that comes with perl5.005
is severly broken (does not support modules or something similar).
Somebody said it would probably be better to go back to perl5.004 and
use the a3 release of the compiler.
Marius
------------------------------
Date: 2 Dec 1998 14:33:46 GMT
From: mayer1b@unisys.co.at ( hans mayer )
Subject: Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)?
Message-Id: <912609181.225884@scarlatti>
In article <741n0e$fam@sjx-ixn8.ix.netcom.com>,
Mike Marshall <removeMike@SinglepointSys.com> wrote:
>On Solaris 2.5.1, I'm loading Perl from the sunfreeware.com site. I'm
>curious.
>
>This package loads into /opt/LWperl. Perl scripts, in general, have a
>sh-bang line (#!/usr/bin/perl) of /usr/bin/perl, or /usr/local/perl, etc...
>
>I understand that /opt on Solaris 2.5.1 is for optional software, but do
>Administrators leave Perl in /opt? Does this mean that they change sh-bang
>lines on perl scripts? Or, Is there typically some sort of linking going on
>to connect the two?
if you have a lot of perl-scripts for example with #!/usr/bin/perl
create a symbolic link as root:
ln -s /opt/LWperl/bin/perl /usr/bin/perl
--
best regards from vienna | mayer (at) unisys.co.at_SPAM
hans | mayer (at) relay.bfl.at_SPAM
------------------------------
Date: 02 Dec 1998 15:33:59 +0100
From: Aleksandar Milivojevic <alex@srce.hr>
Subject: Re: Perl on Solaris 2.5.1 (#!/opt/LWperl/bin)?
Message-Id: <x790gqsje0.fsf@pc-alex.srce.hr>
Mike Marshall (removeMike@SinglepointSys.com) wrote:
> On Solaris 2.5.1, I'm loading Perl from the sunfreeware.com site. I'm
> curious.
>
> This package loads into /opt/LWperl. Perl scripts, in general, have a
> sh-bang line (#!/usr/bin/perl) of /usr/bin/perl, or /usr/local/perl, etc...
Just make a symbolic link:
# ln -s /opt/LWperl/bin/perl /usr/bin/perl
Usualy, perl scripts either expect to find /usr/bin/perl or have some
wired paths so you'll have to change them anyway.
> I understand that /opt on Solaris 2.5.1 is for optional software, but do
> Administrators leave Perl in /opt? Does this mean that they change sh-bang
> lines on perl scripts? Or, Is there typically some sort of linking going on
> to connect the two?
Most people will install it in /usr/local because it will install
itself there by default when you are building it from source. Most
people will also make a symbolic link from /usr/bin/perl to wherever
it is realy installed.
> I'm sort of new to Solaris and Perl, and just wondered what the typical
> environment looks like in the real world (if there is one.)
Typical perl environment? This is a joke, right?
--
Aleksandar Milivojevif | alex@srce.hr | http://jagor.srce.hr/~alex/
Opinions expressed herein are my own.
================================ooooO=Ooooo==============================
Real Users never know what they want, but they always know when your
program doesn't deliver it.
------------------------------
Date: Wed, 2 Dec 1998 09:27:30 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Perl Script to take data off a form and post it to the operator
Message-Id: <36655bdf.0@news.mediacity.com>
Appears like the form is calling testform.cgi.
Ben
Neil Elliott wrote in message <366526B1.A181EFFB@gre.ac.uk>...
>I have been trying to get this perl script to work with a form for ages
>and I have hit my head on a brick wall
>I know there arse some bugs but I can't really find them.
>
>The Perl Script is ment to take the information inputting in the form
>and display html pages when data is inputed
>and then right the data to a file then mail that file to me.
>
>The address for this is
>
>Location of Webpage http://www.gre.ac.uk/~en02/code/accept/accept.htm
>Then form calls
>http://www.gre.ac.uk/~en02/cgi-bin/testform.pl
>
>If any one has any suggestions there would be greatly appreated.
>
>___________________________________________________________________________
__________
>
>Neil Elliott
>CMS Support
>The University of Greenwich
>London
>England
>
>E-mail en02@gre.ac.uk
>
------------------------------
Date: 02 Dec 1998 14:09:19 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: problem with \ifthenelse inside tabularx
Message-Id: <83hfvesnb4.fsf@vcpc.univie.ac.at>
Re: problem with \ifthenelse inside tabularx, Peter
<priocreux@cs.man.ac.uk> said:
Peter> I am trying to create tables with a variable number
Peter> of lines based on the values of the arguments to the
Peter> macro that generates them. Someone locally suggested
Peter> using the ifthen package, which does almost
Peter> everything I want, but there is a remaining problem.
Peter> \documentclass{article}
[snip]
That is latex
This is comp.lang.perl.misc
^^^^
Hello, earth calling... :-)
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Wed, 02 Dec 1998 14:38:25 GMT
From: mbrennan@observera.com
Subject: substitution and spacing
Message-Id: <743jd1$m9q$1@nnrp1.dejanews.com>
I have code that substitutes part of a line in a file. The line example is as
follows:
Some Other Text Information
StartX 0
StartY 0
StopX 100
StopY 100
I want to substitute the line to be (note the alignment) :
Some Other Text Information
StartX -50
StartY -50
StopX 49
StopY 49
I can easily substitute the lines and the numbers, what I am having problems
with is the spaces in between the substituted text and numbers (including
minus sign) - to keep the numbers aligned on the right, and the text aligned
on the left. The numbers I am replacing will vary in length, so the
substitution has to be flexible. I'm stumped! Any suggestions.
Thanks - Michelle Brennan
mbrennan@observera.com
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 02 Dec 1998 16:45:06 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: mbrennan@observera.com
Subject: Re: substitution and spacing
Message-Id: <m34srek0ot.fsf@joshua.panix.com>
mbrennan@observera.com writes:
> I can easily substitute the lines and the numbers, what I am having problems
> with is the spaces in between the substituted text and numbers (including
> minus sign)
perldoc -f printf
perldoc -f sprintf
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Wed, 02 Dec 1998 10:55:29 -0500
From: Jon Peck <jmp35@cornell.edu>
To: mbrennan@observera.com
Subject: Re: substitution and spacing
Message-Id: <366562F1.CF8267FB@cornell.edu>
Given a line like $line=" StartX 0";
Try this: $line =~ s/\A(\s)([^\s])(\s)([^\s])//;
It should assign $1=" ", $2="StartX", $3=" ", $4="0"
Thus allowing you to know the exact number of spaces: length($3)
If "(\s)" doesn't yield a specific size witespace, try "( +)"
mbrennan@observera.com wrote:
>
> I have code that substitutes part of a line in a file. The line example is as
> follows:
> Some Other Text Information
> StartX 0
> StartY 0
> StopX 100
> StopY 100
>
> I want to substitute the line to be (note the alignment) :
> Some Other Text Information
> StartX -50
> StartY -50
> StopX 49
> StopY 49
>
> I can easily substitute the lines and the numbers, what I am having problems
> with is the spaces in between the substituted text and numbers (including
> minus sign) - to keep the numbers aligned on the right, and the text aligned
> on the left. The numbers I am replacing will vary in length, so the
> substitution has to be flexible. I'm stumped! Any suggestions.
>
> Thanks - Michelle Brennan
> mbrennan@observera.com
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 2 Dec 1998 14:01:32 GMT
From: Sunil Karnik <sunilk@mahindrabt.com>
Subject: Trim Functionality ??
Message-Id: <3665483B.B9059126@rotfl.com>
Hi
Is there any function for trimming the leading and trailing spaces of a
string??
..something like alltrim(char *) in C ...
Thanx
Sunil
------------------------------
Date: Wed, 2 Dec 1998 09:29:34 -0600
From: "BenJamin Prater" <bprater@jipes.com>
Subject: Re: Trim Functionality ??
Message-Id: <36655c5a.0@news.mediacity.com>
Sunil,
I'm pretty darn sure the FAQs explain how to clip leading and trailing
spaces. Here's a hint: It's not a function, it's a regex (or two).
Ben
Sunil Karnik wrote in message <3665483B.B9059126@rotfl.com>...
>Hi
>Is there any function for trimming the leading and trailing spaces of a
>string??
>..something like alltrim(char *) in C ...
>Thanx
>Sunil
>
------------------------------
Date: 2 Dec 1998 15:11:42 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: win32API module available for Unix?
Message-Id: <19981202101142.00504.00000919@ng118.aol.com>
Hi Elcaro:
>Does anyone know if the win32API is available for Unix?
> I've seen the module but it seems to be precompiled for i386
> and I need to do this work under Sun Solaris.
It's called "syscall". The module provides that function for Win32
shared libraries to users of Win32 Perl ports since system calls are
handled in an "un-Unix-like" manner on Win32. But the module
doesn't provide any of the API itself.
It sounds like you want "Win98_for_Solaris" ...
<message halted due to giggling>
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Wed, 02 Dec 1998 13:25:38 +0000
From: Howard Price <priceh@ms.com>
Subject: XS / C++ and the 'simple' example CCsimple - HELP!
Message-Id: <36653FD2.9AFA33D2@ms.com>
I unzipped the file from CPAN, ran:
perl Makefile.pl
then ran make and I got these errors:
Error: No INPUT definition for type 'color *' found in CCsimple.xs, line
34
Error: No OUTPUT definition for type 'color *' found in CCsimple.xs,
line 34
Error: No INPUT definition for type 'color *' found in CCsimple.xs, line
37
Error: No INPUT definition for type 'color *' found in CCsimple.xs, line
40
gmake: *** [CCsimple.c] Error 4
Inside the typemap file I see:
TYPEMAP
color * O_OBJECT
What is it expecting?
Thanks.
Howard
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4341
**************************************