Jan Harders wrote:
> Python is nuthing but a scripting language. I think O'Reilly
> has a book or two about it. Check www.oreilly.com
That's a bit like saying "Perl is nothing but a scripting language -- I
think ORA has a book or two about it". You can do Real Things in Python,
just like in Perl
Scott K Purcell wrote:
> But anyway what is Phython,
A spelling mistake :-). Python is an interpreted language by Guido van
Rossum, named after "Monty Python" and not after a snake. Its most striking
feature is that whitespace is significant: instead of using braces to
delimit blocks, you use ind
express my thanks for this service
ActiveState has provided us. Being able to 'ppm install ' is very
convenient, and many useful modules are available for PPM (DBI, GD, Tk,
...). Thanks, Jan, Murray, and the others!
Cheers,
Philip
--
Philip Newton <[EMAIL PROTECTED]>
All opinions a
Garold L. Johnson wrote:
> [snip]
> From the Visual Perl page on ActiveState:
>
> "Visual Perl is a plug in for Microsoft's next-generation development
> environment, Visual Studio 7."
> ...
> "Visual Perl will be available at the same time as Visual Studio 7."
> I read this as saying that Visual
Please don't omit attributions. You've snipped "Philip Newton wrote:" twice
already.
Paul Rogers [CE] wrote:
> Philip Newton wrote:
> > So having Visual Perl is orthogonal to having Visual C++;
> > you can have one without the other. As I understand it, at
Paul Rogers [CE] wrote:
> Philip Newton wrote:
> > And if you haven't got a C compiler, then Visual Perl won't
> > help you with this either.
>
> Well, I think it was a reference to Visual Perl as it will be
> included in Visual Studio, which itself includ
Matthew Persico wrote:
> Does this mean we will FINALLY be able to drop all the PPM
> crap and just invoke the Visual Studio C compile where
> necessary on ANY CPAN module?
Hm? You could do that all along. The sources AS used to compile their
version of Perl are available, so you can build your
Gregory Bair wrote:
> Can a hash be the value of an array element?
No, but a reference to a hash can.
> What comes to mind is something like
> $array[1]{hashkey} = hashvalue, though this seems silly to
> me.
Let me guess: you didn't try it. That's how I'd do it, anyway.
${$array[1]}{hashk
Felice Vittoria wrote:
> Is there a Perl module (or function) that will calculate the
> date/time difference between a start time and end time?
The standard time representation in Perl is seconds since the epoch -- so,
if you store the value of time() at one point and then again, later, you can
Allan wrote:
> Im using the PPM on build 522. I type in PPM>install Find::File
> Then I get an error.
Correct me if I'm wrong, but I think you're looking for File::Find (not
Find::File) -- and that comes with Perl.
Try this:perl -MFile::Find -e 1
If it just gives you a prompt, you're fine;
Eric Stephenson wrote:
> $file = "install.log";
> $time = (stat("$file"))[10];
> $ltime = localtime($time);
>
> print "$ltime\n";
And you get a value in 1969?
Do you also get a message "Use of unitialized value at ... line ..."? You
*are* running with -w and 'use strict', aren't you?
What's
[EMAIL PROTECTED] wrote:
> I have another situation where I am calling a select
> subroutine in PERL based on the table a user selects.
> This select statement is very basic:
>
> select * from $tablename
>
> From here how do I pick only the columns of my choice?
Well, if you know which columns
Eric Stephenson wrote:
> Here is the snippet of code:
>
> $file = "install.log";
> $time = (stat("$file"))[10];
> $ltime = local($time);
>
> print "$ltime\n";
>
> And what I am getting out:
>
> Wed Dec 31 19:00:00 1969
This is not your code.
Please post the code you are using, using copy-a
Kathryn Cassidy wrote:
> Now the module will need to use the DBI module in order to connect to
> the database, but the scripts that it will be called from will also
> usually use DBI. Does this mean that the whole DBI module will be
> imported twice for each script which uses this module? Or doe
Justin Rogers wrote:
> "Martin, James S." wrote:
> > How do you stop someone from sending the same question to a
> > mailing list over and over again, and do it remotely?
>
> Ask them to read the FAQ first, after spending several hundred
> man hours creating a FAQ. Also, ask them to read the ar
khizar wrote:
> this code works fine for all files EXCEPT PDF files where it
> fails to detect the PDF file as binary file and hence binmode
> (FILEHANDLE) is not executed
So set binmode() on PDF files yourself.
> #
> # read from the file into a strea
Kevin Plyler wrote:
> "Can't find unicode character property definition via
> main->AAA0001 or AAA0001.pl at unicode/Is/AAA0001.pl line 0"
>
> What I don't understand is why the run time error for the
> '\p'? '\p' is not a regular expression
> meta character, so it should have just looked for
Carl Campbell wrote:
> $mode = 0777;
> mkdir ("C:\TEST1", $mode);
> mkdir ("C:\TEST1\FOLDER1", $mode);
> mkdir ("C:\TEST1\FOLDER2", $mode);
> mkdir ("C:\TEST1\FOLDER3", $mode);
> mkdir ("C:\TEST1\FOLDER4", $mode);
> mkdir ("C:\TEST1\FOLDER5", $mode);
This creates a six directories under drive C's
Ben Hambidge wrote:
> I have the following condition:
>
> if ( $x =~ /^[one|two|three|four]/ ) { ...}
This tests whether $x contains any of the characters e f h n o r t u w | at
the beginning of the string, and is unlikely to be what you want. Maybe you
meant
if ( $x =~ /^(?:one|two|three|f
Simon Oliver wrote:
> Lee Goddard wrote:
> >
> > I'm away from my Camel books: could someone please let me
> > know the way to globablly substitute a string over an
> > array, and leave the array as an
> > array?
>
> map s/x/y/g, @list;
Shame to have map build up a return array and then discard
Joe Schell wrote:
> I couldn't be sure. I just looked at it briefly and many
> code segments like this
>
> xopen \*STDERR, ">&" . fileno $dad_err
>
> seems to suggest that it might be relying on operating system
> redirection that Win 9x doesn't have.
No, that's Perl syntax. See `perld
Matthew Rochlin wrote:
> Find the element no of the last element of a grep match?
> That's pretty much the scalar output of grep.
> e.g.
> @list = qw(ham pig barn dog hammer lost);
> $nofound = @found = grep {/ham/} @list;
> print @found[$nofound-1]; # $nofound-1 should index to the last found
> I
[Small nit pick]
David Cassell wrote:
> You wrote:
No, I didn't -- it was Peter Eisengrein.
> > Anyone know what is the max length of a character string?
>
> How much RAM memory do you have? That's the limitation you'll have
> in Perl.
RAM memory is like LCD display or USA of America, or Nat
Kathryn Cassidy wrote:
> I've got a script which has to read in a variable number of
> parameters.
> Up 'till now, I've been using the CGI param() function to read in each
> variable one at a time. This won't work if I don't know how many
> variables there might be though, or what they'll be ca
[EMAIL PROTECTED] wrote:
> Just wondering if it is possible to store an array in a harsh ?
I think you mean "a hash".
> $this->{'friends'}=( "Jean" , "Eric" , "Yoon");
>
> if it is possible, how can I later retrieve my "friends" array ?
You can't store an array in a hash element (hash values h
alan.swan wrote:
> IIRC, of course it can't work.
> SSI works via the web server replacing the SSI directives
> when serving out the pages.
> CGI works by sending the output directly to the browser. So
> the web server has no chance to process the SSI directives.
That's not quite true, as far a
JIMMY wrote:
> i have a @list that contains elements i do not know. i'm
> using grep to match some words inside the @list.
> for example:
> $match = grep /\d/, @list;
> my question is: is there a way to find the element No. eg:
> $list[number] of the latest match?
I don't think so. You'll proba
Nolen, Mike wrote:
> I need to return all data inside each set
> of <> in a string ...
my $aa = "Mike , Mark ";
print "aa is [$aa]\n";
while( $aa =~ /<([^>]*)>/g ) {
print "Matched [$1]\n";
}
> I've included 2 examples, but they both return
> the last item only...
Tha
Title: Re: Array in Perl
Olivier CLERE wrote:
> Does anybody know how
> to represent an array only
> thanks to an integer?
> Is this posssible anyway?
> The address of an array
> is a scalar but not an
> integer (?)
You can take a reference to an array. This reference, when used in numeric c
Satish Vadlamani wrote:
> I have a directory in which I have about sixty files. Of
> these say 30 have a .ctl extension. The 2nd or 3rd line in
> the files that have a .ctl extension reads something like this
> in all files:
>
> INFILE '/u/svadlama/eCAMPUS/df4.3_2/prototype1/data/buckets.dat'
Hogue, Jon wrote:
> Is there something wrong at the system level with redirection
> and piping in NT.
There's something wrong with redirection on scripts that are called based on
their prefix (e.g. if .pl is associated with Perl, you can start foo.pl by
just typing 'foo.pl', but redirection does
Joseph P. Discenza wrote:
> CGI can use any language whatsoever, as long as the web server can
> figure out how to fire up the "script": it could be Perl, or Python,
> or a C (or Fortran, if you're really masochistic) executable.
Or shell scripts/batch files, for that matter. As long as it's some
Paul Rogers [CE] wrote:
> Tim Meadowcroft wrote:
> > ASP is an environment, pick your language to go with it (I
> > use Perl). So ASP versus Perl is meaningless, but "ASP and
> > Perl" vs "mod_perl" is a valid comparison.
>
> au contraire, mon frere. .pl vs .asp is a perfectly valid
> comparis
Olivier CLERE wrote:
> Here is my Perl code:
>
> %berval= (
> bv_len=>3,
> bv_val=>"123",
> );
>
> $ldapctrl ={
> ldctl_oid=>"2.16.840.1.113730.3.4.2",
> ldctl_iscritical=>1,
> ldctl_value=> %berval,
> };
You probably want the last line to be
ldctl_value =
Leon wrote:
> Does anyone have any performance enhancing considerations
> that I should build into my program? I was thinking along
> the lines of using DBD-Oracle to select a certain number
> of records at a time, and then loop through the resultset
> and send one at a time with Net-SMTP.
As fa
Jay wrote:
> Is it possible to get the output of a dynamically
> generated web page for use as if it were an actual file?
Not quite, but you can use e.g. LWP::Simple or LWP::UserAgent to fetch the
entire web page into a string or into a local file. (And if, for some
reason, you want to read
Dennis Hanson wrote:
> @data = (10,20,30);
> $c = 1;
> while ( @data = $c ) {
> $c = undef;
> }
>
> I am fairly certian that with the Unix build @data will be
> assigned an undef and the loop will terminate after the first
> pass. With ActiveState the @data variable reta
Andrew Bastien wrote:
> vim??? Real programmers don't need any of that fancy screen-oriented
> stuff; real programmers use ed!
Real programmers don't need compilers or linkers, since they program by
cat >executable
(or, optionally on Win32:copy con program.exe )
Cheers,
Philip
---
Troy Sniff wrote:
> Can anyone tell me where I can find some good mailing lists
> for Perl on Unix?
Well, if you include newsgroups there's comp.lang.perl.misc and
comp.lang.perl.moderated, which have a fairly strong Unix bias (that's
news:comp.lang.perl.misc and news:comp.lang.perl.moderated fo
Kuhnibert wrote:
> -MM-DD.
> e.g.
> 2000-05-16.1
> 2000-05-16.2
> 2000-05-16.3
>
> now i want to create a new file, it's still the 16.05.2000
> and i need the next available suffix (4 for the a.m.
> example), what would be the easiest way to do so?
Perhaps something like this (untested):
Title: Re: Win32::OLE -- Word 97 not visible on first try
(Please excuse the MIME and HTML garbage; our mail server is misconfigured)
Robert Coney wrote:
> On first execution (listed below), the "Now starting Word" message is
> printed, and according to Task Manager, Winword.exe starts,
>
Title: Re: C in Perl
Olivier CLERE wrote:
> The "navigator" is Netscape Communicator.
From the API.pm, I assume you're using LDAP to talk to Netscape Communicator. This was not clear to me previously.
> Enclosed you will find the API.pm
> file, which is used by my
> program. Inside the lda
Olivier CLERE wrote:
> Here is the C code you asked me:
I'm quoting this to the list because there might be people there who can
help you better. I do not quite understand why you reply only to me.
> /*
> typedef struct berval {
> unsigned long bv_len;
> char *bv_val;
> };
>
> typedef stru
Olivier CLERE wrote:
> Enclosed is the C code (which works) and
> the Perl code I implemented (which does not seem
> to work).
What do you mean by "doesn't work"? In what context do you use %ldapctrl and
@tableau? What do you expect to happen, and what does happen?
> Do you have any suggestions?
Olivier CLERE wrote:
> Actually I would just like to implement
> an array of pointer to a structure in Perl.
> As I can not manage, I thought about
> doing it in C and incorporating my C code
> (just the main program, which is short) in
> my C code.
> That's the reason.
I assume you mean you wan
[Please excuse if this message comes as MIME type multipart/alternative; our
mail server was reconfigured and I don't know whether they've changed it
back yet.]
Olivier CLERE wrote:
> Could anybody give me an easy method to
> include C functions in a Perl CGI file?
> Is this possible anyway?
> Wh
Title: Re: HELP Getting an error in Line3
Philip Newton wrote:
[stuff in HTML]
Sorry about the post in HTML -- I don't know how that happened. Standard format for me is plain text, and I was replying to a plain-text message.
Cheers,
Philip
Title: Re: HELP Getting an error in Line3
[EMAIL PROTECTED] wrote:
> Philip, while I always view your posts as a source of illumination,
Why, thank you :-). That's nice to hear.
> I do want to point out one error in your reply to this person.
> You wrote:
>
> >> $good_tel_number = 1
Title: Re: Referencing Question
Ewen, Ed wrote:
> The missing $ in front of key was a typo, I have it in the program
Don't re-type. Use copy and paste.
Otherwise the code people are debugging is not the code you are using.
Cheers,
Philip
Trevor Walker wrote:
> Unfortunately, I do not have a C prototype for the DLL, or its source
> code... because it is written in Delphi (!!). The call used
> from Delphi is attached... it should give you an idea.
I can't really tell as I haven't had any experiencing interfacing Delphi or
Pascal w
Tom Rathborne wrote:
> ---BEGIN---
>
> use Win32::API;
> $library = "KrugerCall.dll";
The docs imply you don't need the '.dll' ending.
> $functionname = "FanSelFnName";
> @argumenttypes =
> ("P","I","I","I","I","I","I","I","I","I","I","I","P");
> $returntype = "P";
> $lpPoint = pack("III", 1,
Trevor Walker wrote:
> Is possible to call functions from Win32 DLLs using Perl?
I think Win32::API is what you need. I believe it's available from Jenda's
repository at http://Jenda.McCann.cz/ .
> I have looked everywhere, and can only find a vague thread
> on comp.lang.perl relating to this.
Naeemah Small wrote:
> Where can I download unistd.h?
It comes with your C compiler. If you don't have a compiler, you probably
don't need it. If you have a compiler but it doesn't have unistd.h (or any
other header file), you most probably cannot use anyone else's version,
since header files are
[EMAIL PROTECTED] wrote:
> I'm new to Perl and am attempting a script that I found in a
> book.
That's pretty awful code. What book is it from? You may with to consider
other options.
> You would think that it would run without modification! :(
Though maybe some modifications would do it some
Douglas Wilson wrote:
> my @array = @hash{sort keys %hash};
Clever! Wouldn't have thought of that. Shows again that hash slices are
underused.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTEC
Andrew Bastien wrote:
> In the spirit of TIMTOWDI, you can also do:
>
> sort {$thehash{$a} <=> $thehash{$b}} keys %thehash
This does something else -- it sorts the hash keys according to the values,
using numeric comparison. This only works correctly if all the values are
numbers. And besides, t
Thomas_M wrote:
> There are very few, if any, Perl resources as good as this
> list. That's why there are a lot of unix users subscribed.
> The clpm newsgroup just isn't as good as it used to be.
This is partially because it attracted a fair number of (fairly) clueless
newbies who asked the same
Ian D. Stewart wrote:
> [EMAIL PROTECTED] wrote:
> >
> > This is a Windows, not Linux, based list. And Perl has
> > little to do with setting up mail accounts (unless you
> > want to automate it).
>
> While I see Woodrow's point, in light of the fact that ActiveState is
> now supporting Linux a
Jan Dubois wrote:
>
> http://www.geeksalad.org/fork/all.html
Nice explanation! I like it.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL PROTECTED]
For non-automated Mailing List support, sen
[EMAIL PROTECTED] wrote:
> {# Capture to $1
> (?: # Group
> [0-9]\x00 # Digit followed by \x00
> )+ # One or more
> }# End capturing to $1
Capturing parentheses should be ( ) and not
Ned Konz wrote:
> # this is four times as fast as s/// solution
> sub toutf
> {
> my $s = shift;
> pack('v*', unpack('c*', $s));
> }
Cool :-) Wouldn't have thought of that.
> while (<>)
> {
> my $line = $_;
> map { $line =~ s/$_/$subs{$_}/g } keys(%subs);
Some people con
[EMAIL PROTECTED] wrote:
> OK. Now I can do "simple" replacement on a Unicode string
> read from a file. For example, if "Test" (T\x00e\x00s\x00t\x00")
> is in the file then I can replace it with "TEST".
Though you probably want to replace it with "T\x00E\x00S\x00T\x00" instead.
> What if I hav
[EMAIL PROTECTED] wrote:
> Do I need to do the "expansion" thing for each string that I want to
> replace?
Yes, because in the file you have the "expanded" version. So if you want to
match it, you need an "expanded" version of a search string.
Example, the file has "T\00e\x00s\x00t\x00" in it, t
[EMAIL PROTECTED] wrote:
> $string =~ s/(.)/$1\x00/g;# expand ANSI to UTF-8 (not the most
> efficient, but...)
This converts ANSI to UTF-16. 'Testing' in UTF-8 is "Testing"; in UTF-16 it
is "T\x00e\x00s\x00t\x00i\x00n\x00g\x00" or
"\x00T\x00e\x00s\x00t\x00i\x00n\x00g" (depending on endianness
Aaron wrote:
> ## 3 ##
> Whatever happended to Jan Krynicky's site?
If you mean Jenda.Krynicky.cz, I believe it's been having DNS problems for
quite a while now. Use Jenda.McCann.cz, which works.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubs
[EMAIL PROTECTED] wrote:
> Or is there a module that will make the gzip
> file appear as an unzipped text file? Like a file handle or
> something...so I just need to declare the file handle and use it for
> reading...
There's an example in perlop. Look in the section on "I/O Operators" for an
Carl Jolley wrote:
> To cover all the bases ypu might want to consider:
> my @info=split/[\\/:]/, $file);
And hope you don't get any VMS-style paths :-).
(AFAIK, they look like LOGICAL:[DIR.DIR.DIR]FILENAME.EXT;VERSION , though
I've never used VMS myself.)
But there're probably a lot more peopl
Bill Stennett wrote:
> I need to remove spaces from user input at the start and end
> of the string.
RTFM. perldoc -q space gives two hits, one of them from perlfaq4: How do I
strip blank space from the beginning/end of a string?
Executive summary: use ^\s+ and \s+$ to replace blank space with
OK, I just saw David Cassell wrote an excellent answer, but I had already
started composing this before leaving last night, so I'll send this off
anyway. Hope it gives a little additional insight.
Andrew Staples wrote:
> if ($zone !~ m%^(?:((?:\w[-A-Za-z0-9]*\.)+\w\w+)|((?:(?:[12]
> [0-9][0-9]|[1
[EMAIL PROTECTED] wrote:
> Philip,
>
> Does this method have any shortcomings?
>
> perl -e "BEGIN{@ARGV=glob join(q( ), @ARGV)} s/f:/g:/gi"
> -pi.bak *.htm *.dat
>From a quick look, it should work fine. One "shortcoming" might be that you
have to type in this incantation in *every* one-liner
Andrew Bastien wrote:
> Whether or not single quotes work depends on the command, as
> it's the command that has to parse the argument list.
However, at least on NT (cmd.exe) double quotes appear to be interpreted
either by the shell or (possibly) by Perl -- at least, if I pass "foo bar"
as a
Philip Newton wrote:
> If you can't update the location (e.g. Jenda.Krynicky.cz ==>
> Jenda.McCann.cz), you can comment out the whole entry (from
> to ) by placing around the
> definition (like in HTML).
But backup first, or everything between will disappear the next
t
[EMAIL PROTECTED] wrote:
> 6) Edit it's entry in ppm.xml. Repeat as often as necessary.
Follow-up to my previous message (which hasn't reached me back, yet): If you
comment out entries with as I said previously, the entry will
disappear :-( the next time the ppm.xml is updated (e.g. by verify
[EMAIL PROTECTED] wrote:
> [I recently ran into the same problem as was posted here and on the
> PDK list. Here's a copy of the message I just sent to the PDK list, I
> hope it is helpful]
Thanks a ton! This has been very helpful -- especially the explanation of
why it occurs.
> 6) Edit it's e
Bapat, Aniruddha (IE03) wrote:
> when I tried
>
> c:\>perl -e 's/f:/g:/gi' -p -i.bak *.htm
> a message is shown as 'can't open *.htm: No such file or directory'
> when I am specifying a specific file in the same command nothing is
> happening and no error msg is shown.
1) As far as I know, you
Dunnigan,Jack [Edm] wrote:
> Why use 'seek' at all? You have already opened the file in
> 'append mode' which should bring you to the bottom of the file.
Look at `perldoc -f flock` -- it uses the seek in its example, too. It's
supposedly to guard against somebody else appending to the file betwe
byron wise wrote:
> foreach $key (keys %form) {
> print DATA "$form{$key}:"; }
You could replace with by
print DATA join ':', values %form;
if you want. This will also eliminate the trailing colon (since you said
values are *separated* by colons, not *terminated* by colons.
Cheers,
P
Martin, James S. wrote:
> So non Win32 systems cannot use any of the Win32 mods? like
> Tie::Registry, etc?
Not if those modules require C code -- since the header files and DLL's etc.
that are needed to support those functions aren't available on non-Win32
systems.
Cheers,
Philip
---
You are
Martin, James S. wrote:
> I have a CGI perl program that prints out the result of a
> form to plain text in a web browser. I would like it to
> instead write this file to the user's local machine. Is
> this possible? I can get the username/pw from people on
> the form.
Can the web server mac
Jack Dunnigan wrote:
> if ($^O eq "MSWin32"){
> require 'Win32::Sound';
> # There doesn't seem to be an import sub in the Sound.pm file
> }
Try calling 'import Win32::Sound' -- if Win32::Sound exports constants, it's
presumably a subclass of Exporter. So calling the import method will call
Ex
[Problem with Unix shells globbing and DOS not]
You can also use Jenda's wonderful G module -- download it, put '-MG' in the
environment variable PERL5OPT, and you have automagic globbing.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe,
jimi malcolm wrote:
> if someone could point me in the right direction, that would
> be enough.
perldoc -q "fetch an HTML file"
It's in perlfaq9.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
[EMAIL
[EMAIL PROTECTED] wrote:
> Is there a Perl-UNIX mailing list?
Well, if you read newsgroups, there's comp.lang.perl.misc. I don't know of a
mailing list specifically for Perl on Unix.
Cheers,
Philip
---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forwar
Paul Rogers wrote:
> Jimmy S. Lim wrote:
> > how do you escape a "." (dot)? i would like do a pattern
> > match w/ a "." within the pattern.
>
> just like the website: \.
What website is that? Do you mean slashdot.org? That's abbreviated "/.",
since it's not "backslashdot.org". Hope this helps.
alan.swan wrote:
> I think I know what's happening now.
> Correct me if I'm wrong.
> You said that the script stops becos it got replaced by the
> other instance.
> Is that becos the instances share the same script
> (and thus the same name and name space)?
No. What happens is the first script c
Alan Swan wrote:
> I have a script I want to run 6 instances of it simultaneously.
> So I have a calling script to loop 6 times using exec to run it.
> But my calling script always dies after the first loop.
Did you read the documentation for exec (`perldoc -f exec`)? It says:
The `exec()'
Hamish Moffatt wrote:
> If you just want to trim spaces, something like
>
> $var =~ s/\s*?(\S)/$1/;
>
> should do the trick. No doubt there are better ways.
The canonical answer (listed, e.g., in `perldoc -q "strip blank space"`),
is:
$var =~ s/^\s+//;
and for end:
$var =~ s/\s+$//;
87 matches
Mail list logo