Bryan R Harris wrote:
This is unintuitive:
perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}'
... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl's
interpreting that "012" as octal. We sometimes have our numbers zero padded
to make the columns line up, they'
Greetings,
On Fri, Feb 19, 2010 at 02:23:07PM -0800, John W. Krahn wrote:
> You don't have to escape a plus sign in a quoted string:
>
> $string =~ s/ /+/g;
Yeah. I see. I understand my fault.
--
Happy hacking, Sergey Matveev
FSF Associate member #5968 | FSFE Fellow #1390
--
To unsubscribe,
> "SM" == Sergey Matveev writes:
SM> $string =~ s/ /\+/g;
why are you escaping the + there? that is a replacement string, not a
regex. it is double quotish but not much more than that. + is just a
regular char there like almost all chars in double quoted strings.
this is a common thing i
>
>> Is there any way to keep perl's eval from interpreting numbers starting
>> with
>> "0" as octal?
>
> Stringify them ?
> 2 * '012' is 24.
Manually?
We could have thousands of them. How do I stringify them when they may
potentially be in the middle of an expression? eg. 75+32*(15+052/3)
- Original Message -
From: "Bryan R Harris"
Is there any way to keep perl's eval from interpreting numbers starting
with
"0" as octal?
Stringify them ?
2 * '012' is 24.
Cheers,
Rob
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginn
This is unintuitive:
perl -e 'print "> "; while(<>) {print(( eval $_ )[-1], "\n> ")}'
... then enter 2*012. It prints "20". 2*12 is obviously 24, but perl's
interpreting that "012" as octal. We sometimes have our numbers zero padded
to make the columns line up, they're not octal.
Is there
Sergey Matveev wrote:
Greetings,
On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote:
I have to changes all the spaces in a string to +'s. Is there an
easy way to do this. The length of the string and the number of
spaces will always be changing.
$string =~ s/ /\+/g;
That is all.
Thanks Sergey,
That was just staring at me in the face.
If anyone is interested a little code to spit back the latitude and longitude
of an address. Next step is to get it too pull the address from a mysql
database and then update it.
#!/usr/bin/perl
use war
Greetings,
On Fri, Feb 19, 2010 at 03:54:27PM -0500, Erik Lewis wrote:
> I have to changes all the spaces in a string to +'s. Is there an easy way to
> do this. The length of the string and the number of spaces will always be
> changing.
$string =~ s/ /\+/g;
That is all. All spaces will b
I have to changes all the spaces in a string to +'s. Is there an easy way to
do this. The length of the string and the number of spaces will always be
changing.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl
==
What I am trying to do is to read the "download.properites" file first
and then change the value for "currentDate" and then store it back to
property file. Most of this works. But while writing it back to the
property file it appends all the properties at the
olivier.scalb...@algosyn.com wrote:
> $ cat test.txt
> keyword1 word1, word2
> word3;
> blabla
>
> blabla
>
>
> keyword2
> word4, word5,
> word6, word7, word8,
> word9;
>
> bla bla
> bla bla
>
> keyword1
> word10, word11;
#!/usr/bin/perl
use strict;
use warnings;
use Data:
Uri Guttman wrote:
> > please show your code. there is no way to help otherwise. s/// is not a
> > pattern matcher but a substitution operator. it uses regexes and can be
> > used to parse things.
> >
> > uri
> >
Here it is ...
$ cat test.txt
keyword1 word1, word2
word3;
blabla
blabla
ke
Paul wrote:
Hello All,
I've been trying to write a Windows script that will log into a Cisco
ASA using SSH2, run an escalated command, and return the results but,
I've run into a wall. When trying to initiate the connection with the
ASA it always fails in the same spot.
Here is the debug from t
(Sorry but I have problem with my ISP, so I repost !)
Uri Guttman wrote:
> > how do you know when a keyword section begins or ends? how large is this
> > file? could free text have keywords? i see a ; to end a word list but
> > that isn't enough to properly parse this if you have 'free text'.
> >
Hi There,
I'm trying to login to a ssl encrypted webinterface with authrization
uing LWP but I don't get authorized for some reason and i can't figure
out why not.
My code:
my $url = 'https://192.168.167.166/'; # Yes, HTTPS!
my $browser = LWP::UserAgent->new;
$browser->credentials(
'ht
On Fri, 2010-02-19 at 14:25 +0200, Shlomi Fish wrote:
> Hi,
>
> On Friday 19 Feb 2010 14:12:51 120 wrote:
> > I know I can do this:
> >
> > $bitvalue=$bitvalue|32
> >
> > but is there a shorthand for this?
> >
> > $bitvalue=|32 does not appear valid - but I'm sure there is probably a
> > way?
>
Hi,
On Friday 19 Feb 2010 14:12:51 120 wrote:
> I know I can do this:
>
> $bitvalue=$bitvalue|32
>
> but is there a shorthand for this?
>
> $bitvalue=|32 does not appear valid - but I'm sure there is probably a
> way?
Yes, there is:
<<<
$bitvalue |= 32;
>>>
You can also do +=, -=, *=, .= etc
I know I can do this:
$bitvalue=$bitvalue|32
but is there a shorthand for this?
$bitvalue=|32 does not appear valid - but I'm sure there is probably a
way?
Daniel
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.p
Guys,
Here I come with the code for the dynamic file update.
Please let me know your comments and concerns with this code.
Thanks for your support and comments.
#
#! c:/perl/bin/perl
use File::Copy;
my $file = shift;
my $old = $file;
my $new = "$file.tmp.$$";
my
20 matches
Mail list logo