Convert int to bitstring

2002-12-18 Thread Bullock, Howard A.
Title: Convert int to bitstring I want to convert int(255) to a string of 8 ones (). I have been trying to use unpack, but am missing something basic I think. I was also playing with the following with less than successful results. What am I doing wrong? One guess was the the @mask

RE: Convert int to bitstring

2002-12-18 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Title: Convert int to bitstring Here is one using printf and you could use sprintf: $_ = "255.255.255.224"; foreach ( split(/\./, $_ ) ) { printf "%b\n", $_;} Output: 1110 Wags ;) -Original Message-From: Bullock, Howard A. [mailto:[EMAIL

Re: Convert int to bitstring

2002-12-18 Thread shurst
I want to convert int(255) to a string of 8 ones (). I have been trying to use unpack, but am missing something basic I think. I was also playing with the following with less than successful results. What am I doing wrong? One guess was the the @mask elements are string values

Re: Convert int to bitstring

2002-12-18 Thread C. Church
I want to convert int(255) to a string of 8 ones (). I have been trying to use unpack, but am missing something basic I think. I was also playing with the following with less than successful results. What am I doing wrong? One guess was the the @mask elements are string values and

RE: Convert int to bitstring

2002-12-18 Thread Joseph P. Discenza
[EMAIL PROTECTED] wrote : Bullock, Howard A. wrote : I want to convert int(255) to a string of 8 ones (). I have : been trying to use unpack, but am missing something basic I think. : I was also playing with the following with less than successful : results. What am I doing wrong? One

RE: Convert int to bitstring

2002-12-18 Thread Bullock, Howard A.
Since it is, in fact, eight bits, you can use chr(255) instead of pack. Thanks to everyone that responded. The above statement made the fog clear. I wanted to count the set bits in a subnet mask so I started with: $mymaskval = ($mask[0]24)|($mask[1]16)|($mask[2]8)|$mask[3]; and ended up

Search Replace

2002-12-18 Thread David Stoltz
Is there a way to open a text file in PERL, and search through it, replacing a certain string with another string? Thanks- ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Search Replace

2002-12-18 Thread Lee Clemmer
Here's one way to do it. The code is readable versus efficient. Note that this preserves the original file in case you screw up. #!/usr/bin/perl -w # search and replace my ($search, $newstr, $file, $temp, $counter); usage() unless scalar(@ARGV) = 1; print Pattern to search for: ;

RE: Search Replace

2002-12-18 Thread Thomas R Wyant_III
Lee Clemmer [EMAIL PROTECTED] wrote: s/$search/$newstr/i You might want to modify this to s/$search/$newstr/igo The o promises Perl you will never change the $search string. Perl will then put it through the regular expression compiler the first time it's encountered, and you _should_

RE: Search Replace

2002-12-18 Thread Lee Clemmer
Lee Clemmer [EMAIL PROTECTED] wrote: s/$search/$newstr/i You might want to modify this to s/$search/$newstr/igo Ah, I realized after I sent it that greedy wasn't set. Oops. But I didn't know about the o, though. The o promises Perl you will never change the $search string. Perl will then

RE: Search Replace

2002-12-18 Thread Hanson, Rob
You can do it right at the command line... ** make a backup of the file first just in case!! ** perl -pi -e s|replace this text|with this text|g somefile.txt It will open somefile.txt, run the regex on each line of the file, and replace the current file with the updated text. Take a look at

RE: Search Replace

2002-12-18 Thread Lee Clemmer
You can do it right at the command line... Now why would we want do to something that fast easy?! ;) Lee ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

RE: Search Replace

2002-12-18 Thread Gerber, Christopher J
-Original Message- You can do it right at the command line... ** make a backup of the file first just in case!! ** perl -pi -e s|replace this text|with this text|g somefile.txt Why make a backup FIRST? Try this... perl -pi.bak -e s|this|that|igo somefile.txt LEGAL NOTICE

Re: PERL Question

2002-12-18 Thread $Bill Luebkert
David Stoltz wrote: I'm a PERL newbie, and have a pretty simply question. I am running a Windows 2000 server, with Active States latest version of ActivePerl running on it... I have a line in a script I need to modify: !/usr/bin/perl -w ~needs to point to d:\perl What's the right syntax?

Re: Problems creating ppd's for use with ppm3

2002-12-18 Thread Sisyphus
- Original Message - From: Scott Scecina [EMAIL PROTECTED] To: Randy Kobes [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, December 19, 2002 1:11 AM Subject: RE: Problems creating ppd's for use with ppm3 No, it happens on 5.6.1.633 also. I'd just been telling people to use

Re: Re: PERL Question

2002-12-18 Thread Mark Bergeron
Bill is right of course. However, if you’re running IIS, which I think you are then you have to fire off the Perl by pointing to the exact location of Perl. My system: C:\Perl\bin\perl.exe Sometimes and I can't quite remember what script[s] it was, you can leave off the .exe and just look into

RE: Problems creating ppd's for use with ppm3

2002-12-18 Thread Randy Kobes
On Wed, 18 Dec 2002, Scott Scecina wrote: No, it happens on 5.6.1.633 also. I'd just been telling people to use ppm(2). Now that I'm rebuilding them for 5.8, I'd like to figure out the problem since ppm(3) is the default... Should the make ppd on 5.8 insert the correct architecture (it

Re: Problems creating ppd's for use with ppm3 - correction.

2002-12-18 Thread Sisyphus
- Original Message - From: Sisyphus [EMAIL PROTECTED] But the 'codebase href' requirement seems also to have changed. Instead of just providing the some-package.ppd (which, under ppm2, was all that was required) they are now giving MSWin32-x86-multi-thread-5.8/some-package.ppd.

Duane Ebron/HNB/HBI/US is out of the office 12/18/02

2002-12-18 Thread Duane . Ebron
I will be out of the office starting 12/18/2002 and will not return until 01/06/2003. I will respond to your message when I return on 01/06/03 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: