Re: Wide character in print at HTML::TreeBuilder::XPath function

2020-01-26 Thread John SJ Anderson
> That, I am very grateful to report, solved that question. I guess the > scope of "use utf8;" is more narrow than I had thought. When you have a bit of time, sitting down and reading through https://github.com/rgs/p5-intelligible-unicode is a re

Re: Wide character in print at HTML::TreeBuilder::XPath function

2020-01-26 Thread Lars Noodén
On 1/26/20 9:58 AM, Lars Noodén wrote: > I've got a long script that has "use utf8;" near the top. The script > parses some HTML and then I run into trouble when printing the result as > shown below: > > use utf8; > use HTML::TreeBuilder::XPath; > . . . > my $xhtml = HTML::TreeBui

Wide character in print at HTML::TreeBuilder::XPath function

2020-01-25 Thread Lars Noodén
I've got a long script that has "use utf8;" near the top. The script parses some HTML and then I run into trouble when printing the result as shown below: use utf8; use HTML::TreeBuilder::XPath; . . . my $xhtml = HTML::TreeBuilder::XPath->new; $xhtml->implicit_tags(1); $xh

Re: function alias

2019-09-04 Thread Paul Johnson
On Wed, Sep 04, 2019 at 02:17:36PM +0800, Wesley Peng via beginners wrote: > Hello, This is actually two different questions with two different answers: > How to make a function alias in perl? $ perl -E 'sub b { say 67 } *says = \&b; says(83)' 67 $ >

Re: function alias

2019-09-04 Thread Andy Bach
; for example, says() is alias to print(). > > sub says > { > print "$_\n" foreach @_; > } > > > On Wed, Sep 4, 2019 at 1:17 AM Wesley Peng via beginners > wrote: > > > > Hello, > > > > How to make a function alias in perl? for examp

Re: function alias

2019-09-04 Thread Andy Bach
> for example, says() is alias to print(). sub says { print "$_\n" foreach @_; } On Wed, Sep 4, 2019 at 1:17 AM Wesley Peng via beginners wrote: > > Hello, > > How to make a function alias in perl? for example, says() is alias to > print(). > > thank

Re: function alias

2019-09-04 Thread Hao Wu
https://stackoverflow.com/questions/4512094/aliasing-a-function-in-perl On Wed, Sep 4, 2019 at 2:17 PM Wesley Peng via beginners wrote: > Hello, > > How to make a function alias in perl? for example, says() is alias to > print(). > > thanks. > > -- > To unsubscribe,

function alias

2019-09-03 Thread Wesley Peng via beginners
Hello, How to make a function alias in perl? for example, says() is alias to print(). thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: What hash function to use

2018-08-25 Thread Luca Cappelletti
Il 23/08/2018 10:21, Olivier ha scritto: Илья Рассадин writes: Hi! See encpass from Passwd::Unix https://metacpan.org/pod/Passwd::Unix Thanbk you, but unless I miss something Password::Unix only provides MD5, not Blowfish. Best regards, Olivier this works? Crypt::Eksblowfish::Bcrypt -

Re: What hash function to use

2018-08-23 Thread Olivier
Thank you Chas, > It looks like https://metacpan.org/pod/Crypt::Password might implement > Modular Crypt Format. > > On Thu, Aug 23, 2018 at 11:38 AM Chas. Owens wrote: > > That prefix appears to for the modular crypt format (see below) and lets the > shadow file use > different hashing functi

Re: What hash function to use

2018-08-23 Thread Chas. Owens
It looks like https://metacpan.org/pod/Crypt::Password might implement Modular Crypt Format. On Thu, Aug 23, 2018 at 11:38 AM Chas. Owens wrote: > That prefix appears to for the modular crypt format (see below) and lets > the shadow file use different hashing functions for different passwords. >

Re: What hash function to use

2018-08-23 Thread Chas. Owens
That prefix appears to for the modular crypt format (see below) and lets the shadow file use different hashing functions for different passwords. It is not part of the Bcrypt spec, but you should be able to just add it on. Does the password hash correctly otherwise? https://passlib.readthedocs.io

Re: What hash function to use

2018-08-23 Thread Mike Flannigan
I hope somebody helps you with this. I don't think this will help you.  It sounds like you already know all of this: https://crackstation.net/hashing-security.htm I don't know what $2b$ is.  Still trying to figure that out. It looks like Digest::Bcrypt was last updated 3/2017. I hope it hasn't

Re: What hash function to use

2018-08-23 Thread Olivier
Илья Рассадин writes: > Hi! > > See encpass from Passwd::Unix > > https://metacpan.org/pod/Passwd::Unix Thanbk you, but unless I miss something Password::Unix only provides MD5, not Blowfish. Best regards, Olivier > > On 8/23/18 10:54 AM, Olivier wrote: >> Hello, >> >> I am not sure if my que

Re: What hash function to use

2018-08-23 Thread Илья Рассадин
Hi! See encpass from Passwd::Unix https://metacpan.org/pod/Passwd::Unix On 8/23/18 10:54 AM, Olivier wrote: Hello, I am not sure if my question is really of beginer level. On a system, I have set my password to "t410" and it has ben hashed to: $2b$10$OQBll77HJqnOR.zqK2jx8ukE6m68Azc7nrsgRdcT6

What hash function to use

2018-08-23 Thread Olivier
Hello, I am not sure if my question is really of beginer level. On a system, I have set my password to "t410" and it has ben hashed to: $2b$10$OQBll77HJqnOR.zqK2jx8ukE6m68Azc7nrsgRdcT6bVfERRmzFV4. What could I use with Perl to get the same result? I tried Digest::Bcrypt but it does not support

Re: perl function for byte to MB conversion

2015-05-25 Thread Brandon McCaig
Hello, On Mon, May 25, 2015 at 08:20:08PM +0530, Sunita Pradhan wrote: > I get following error while loading this module : > Can't locate Format/Human/Bytes.pm in @INC (@INC contains: > /usr/software/lib/perl5/5.8.8/x86_64-linux-thread-multi > /usr/software/lib/perl5/5.8.8 > /usr/software/lib/p

RE: perl function for byte to MB conversion

2015-05-25 Thread Sunita Pradhan
_perl/5.8.8 /usr/software/lib/perl5/site_perl .) at test.pl line 3.BEGIN failed--compilation aborted at test.pl line 3. From: elcaml...@gmail.com Date: Mon, 25 May 2015 13:13:49 + Subject: Re: perl function for byte to MB conversion To: sunita.pradhan.2...@hotmail.com; beginners@perl.org Hi

Re: perl function for byte to MB conversion

2015-05-25 Thread Илья Рассадин
Hi You can find suitable solutions at CPAN. For example, https://metacpan.org/pod/Format::Human::Bytes This module seems to be exactly what you looking for. пн, 25 мая 2015 г. в 15:37, Sunita Pradhan : > Hi > > Is there any perl module for byte , KB, MB conversion ? > > Thanks > Sunita >

perl function for byte to MB conversion

2015-05-25 Thread Sunita Pradhan
Hi Is there any perl module for byte , KB, MB conversion ? ThanksSunita

Re: perl builtin function source code

2015-02-06 Thread prateek goyal
> > > Please excuse me if I am posting wrong question. > > I wan to search the source code of PERL builtin functions e.g. reverse > > function. How can I see that on my machine or on web? > > I went to github repository of perl project but I ma unable to search > t

Re: perl builtin function source code

2015-02-06 Thread Shlomi Fish
Hi Prateek Goyal, On Fri, 6 Feb 2015 12:24:46 +0530 prateek goyal wrote: > Hi, > > > Please excuse me if I am posting wrong question. > I wan to search the source code of PERL builtin functions e.g. reverse > function. How can I see that on my machine or on web? > I went

perl builtin function source code

2015-02-05 Thread prateek goyal
Hi, Please excuse me if I am posting wrong question. I wan to search the source code of PERL builtin functions e.g. reverse function. How can I see that on my machine or on web? I went to github repository of perl project but I ma unable to search that. Please help me. -- *Thanks,Prateek

Re: Embed perl interpreter and call C function from perl?

2014-08-20 Thread Charles DeRykus
t calls a > perl script in an embedded interpreter. > > What I'm missing is the glue between both worlds. > > Is it possible to embed a perl interpreter in a C program, which itself > defines a function "Foobar" which is declared in "foobar.h". Now I use

Re: Embed perl interpreter and call C function from perl?

2014-08-20 Thread Manuel Reimer
ible to embed a perl interpreter in a C program, which itself defines a function "Foobar" which is declared in "foobar.h". Now I use the same "foobar.h" in a XS perl module to use this C interface. Is it possible to make my "module" interact with the fu

Re: Embed perl interpreter and call C function from perl?

2014-08-19 Thread Jim Gibson
o perl. > > What I want to do is to create a function in C code and somehow export it to > my embedded perl interpreter. Then I want to be able to call this C function > from perl code. > > Can someone point me to a good example on how to do this? > > Thank you v

Embed perl interpreter and call C function from perl?

2014-08-19 Thread Manuel Reimer
Hello, there are many very good examples on how to execute perl code from C. For example the following tutorial is very helpful: http://perldoc.perl.org/perlembed.html But it only shows calling from C to perl. What I want to do is to create a function in C code and somehow export it to my

Re: Recursive Validation Function

2014-01-02 Thread John Aten
me time to get back to it some day soon; I was a little optimistic in my planning. Thanks again! On Sep 4, 2013, at 10:55 PM, beginners-digest-h...@perl.org wrote: > > beginners Digest 5 Sep 2013 03:55:27 - Issue 4576 > > Topics (messages 123410 through 123433): > > Re: R

Re: Using a function in a variable

2013-11-09 Thread Rob Dixon
On 09/11/2013 13:33, Unknown User wrote: I have a variable that has a function in it, e.g. my $newtime = "time() + 30"; How can i use it in code so that it always returns time() + 30 when it is called? Does it *have* to be in a string like this? Where has the string come

Re: Using a function in a variable

2013-11-09 Thread Shawn H Corey
On Sat, 9 Nov 2013 16:27:24 +0200 Shlomi Fish wrote: > #!/usr/bin/perl > > use strict; > use warnings; > > my $sub_ref = sub { return time() + 30 }; > > print "Sub-ref call is: ", scalar( $sub_ref->() ), "\n"; Why not just use a sub? sub time_delay { my $delay = shift @_; return tim

Re: Using a function in a variable

2013-11-09 Thread Shlomi Fish
Hi all, On Sat, 9 Nov 2013 08:45:42 -0500 Shawn H Corey wrote: > On Sat, 9 Nov 2013 19:03:00 +0530 > Unknown User wrote: > > > Hi, > > > > I have a variable that has a function in it, eg: my $newtime = > > "time() + 30"; > > How can i use

Re: Using a function in a variable

2013-11-09 Thread Shawn H Corey
On Sat, 9 Nov 2013 19:03:00 +0530 Unknown User wrote: > Hi, > > I have a variable that has a function in it, eg: my $newtime = > "time() + 30"; > How can i use it in code so that it always returns time() + 30 when > it is called? See `perldoc -f eval` Note that u

Using a function in a variable

2013-11-09 Thread Unknown User
Hi, I have a variable that has a function in it, eg: my $newtime = "time() + 30"; How can i use it in code so that it always returns time() + 30 when it is called?

Re: hash function and combining function/operator

2013-09-27 Thread Gerhard Jungwirth
Hi, On 09/24/2013 12:17 AM, David Christensen wrote: > beginners: > > H() is the hash function as you want the same hash of a substring regardless of the position, I think you cannot make the hash dependent on the position of each character in the string. A simple solution co

Re: hash function and combining function/operator

2013-09-25 Thread David Christensen
On 09/25/13 18:53, Jing Yu wrote: Another look at it, and I think I've pointed you to a wrong way. BLAST might not what you need. Sorry about this. No problem. The more I look at it, the less I believe there is such a pair of functions. David -- To unsubscribe, e-mail: beginners-unsubscr

Re: hash function and combining function/operator

2013-09-25 Thread Jing Yu
gt;> I also assume that you are more interested in missing items, so >> hash-value collisions are not a problem. > > My use-case is ~100k files. I'm looking for a hash function that will have > few, if any, collisions. > > >> I also assume that the set of

Re: hash function and combining function/operator

2013-09-24 Thread David Christensen
it would become a simple indexing problem) I also assume that you are more interested in missing items, so hash-value collisions are not a problem. My use-case is ~100k files. I'm looking for a hash function that will have few, if any, collisions. I also assume that the set of string1

Re: hash function and combining function/operator

2013-09-24 Thread Dr.Ruud
On 24/09/2013 00:17, David Christensen wrote: I'm looking for a hash function and a related function or operator such that: H(string1 . string2) = f(H(string1), H(string2)) H(string1 . string2) = H(string1) op H(string2) where: H() is the hash function st

Re: hash function and combining function/operator

2013-09-23 Thread David Christensen
On 09/23/13 18:17, Jing Yu wrote: I don't know the answer but... it sounds like NCBI's BLAST to me, which compares nucleotide or protein sequences. NCBI's FTP site provides local BLAST binaries, and bioperl offers some convenient tools to implement it. That looks like server-side software, ca

Re: hash function and combining function/operator

2013-09-23 Thread Jing Yu
vid Christensen wrote: > On 09/23/13 15:29, Rob Dixon wrote: >> My immediate thought is that the only hash function that can work like >> this is the identity function (or any one-one mapping) because, by >> extension, the hash of a string must be equal to f(the hash of each of &

Re: hash function and combining function/operator

2013-09-23 Thread David Christensen
On 09/23/13 15:34, someone wrote: Er "hash function" as in crypto hashing? a does: H(string1 . string2) = f(H(string1), H(string2)) H(string1 . string2) = H(string1) op H(string2) mean that I'm looking for a hash function and a related function or operator such that

Re: hash function and combining function/operator

2013-09-23 Thread David Christensen
On 09/23/13 15:29, Rob Dixon wrote: My immediate thought is that the only hash function that can work like this is the identity function (or any one-one mapping) because, by extension, the hash of a string must be equal to f(the hash of each of its characters). Not that I can prove this at

Re: hash function and combining function/operator

2013-09-23 Thread Rob Dixon
On 23/09/2013 23:17, David Christensen wrote: beginners: I'm looking for a hash function and a related function or operator such that: H(string1 . string2) = f(H(string1), H(string2)) H(string1 . string2) = H(string1) op H(string2) Hi David My immediate thought is that the

hash function and combining function/operator

2013-09-23 Thread David Christensen
beginners: I'm looking for a hash function and a related function or operator such that: H(string1 . string2) = f(H(string1), H(string2)) H(string1 . string2) = H(string1) op H(string2) where: H() is the hash function string1 is a string st

Re: Recursive Validation Function

2013-09-04 Thread Mike Flannigan
first number can be one through eight, and if it is a six there can be an additional dot followed by a one or two. To make sure that I don't make any mistakes when putting in these tokens, I have tried to write a function to make sure that they are valid: sub validate_tokens {

Re: Recursive Validation Function

2013-09-03 Thread Rob Dixon
On 03/09/2013 06:56, Jim Gibson wrote: For readability, use the extended form and the more modern zero-width assertions \A and \z: if ( $_[0] !~ m{ \A [ric] \. (?:[1-578]) | (?:6 (\.[12])? ) \z }ix ) { Hi Jim You have incorrect parentheses. Your regex matches \A [ric] \. (?:[1-578]) o

Re: Recursive Validation Function

2013-09-03 Thread Rob Dixon
. The first number can be one through eight, and if it is a six there can be an additional dot followed by a one or two. To make sure that I don't make any mistakes when putting in these tokens, I have tried to write a function to make sure that they are valid: sub validate_tokens {

Re: Recursive Validation Function

2013-09-02 Thread Jim Gibson
an be R, I or C, upper > or lowercase. The first number can be one through eight, and if it is a six > there can be an additional dot followed by a one or two. To make sure that I > don't make any mistakes when putting in these tokens, I have tried to write a > function to make sur

Re: Recursive Validation Function

2013-09-02 Thread Andy Bach
R, I or > C, upper or lowercase. The first number can be one through eight, and if it > is a six there can be an additional dot followed by a one or two. To make > sure that I don't make any mistakes when putting in these tokens, I have > tried to write a function to make sure that

Recursive Validation Function

2013-09-02 Thread John Aten
eight, and if it is a six there can be an additional dot followed by a one or two. To make sure that I don't make any mistakes when putting in these tokens, I have tried to write a function to make sure that they are valid: sub validate_tokens { if ($_ !~ /^[ric]\.[123457

Re: Any alternative for substr() function

2013-04-12 Thread Charles DeRykus
On Fri, Apr 12, 2013 at 4:23 AM, kavita kulkarni wrote: > Thanks all, got many ideas from you.. > > My script took ~7 min to run with data file of ~50,000 lines with > substr()/unpack() enabled and same script took ~2 min after disabling > substr()/unpack(). > ... > > For "Devel::NYTProf", I need

Re: Any alternative for substr() function

2013-04-12 Thread Michael Rasmussen
On Fri, Apr 12, 2013 at 04:53:52PM +0530, kavita kulkarni wrote: > Thanks all, got many ideas from you.. > > My script took ~7 min to run with data file of ~50,000 lines with > substr()/unpack() enabled and same script took ~2 min after disabling > substr()/unpack(). No one has asked what kind of

Re: Any alternative for substr() function

2013-04-12 Thread Paul Johnson
rom thousand to millions of lines. > If I use perl in-built function substr() to data extraction, it has huge > impact on performance. Compared to what? > Is there any alternative for this? Perhaps unpack() or regular expressions, but I doubt either would be much faster, if at all. -- Paul

Re: Any alternative for substr() function

2013-04-12 Thread Rob Dixon
On 12/04/2013 12:23, kavita kulkarni wrote: Thanks all, got many ideas from you.. My script took ~7 min to run with data file of ~50,000 lines with substr()/unpack() enabled and same script took ~2 min after disabling substr()/unpack(). That led me to the conclusion that substr/unpack is taking

Re: Any alternative for substr() function

2013-04-12 Thread kavita kulkarni
Thanks all, got many ideas from you.. My script took ~7 min to run with data file of ~50,000 lines with substr()/unpack() enabled and same script took ~2 min after disabling substr()/unpack(). That led me to the conclusion that substr/unpack is taking maximum of my time (and that I should reduce).

Re: Any alternative for substr() function

2013-04-10 Thread Rob Dixon
On 10/04/2013 16:45, Bob goolsby wrote: G'Mornin' Kavita -- Before you go off on a goose chase, how do you know that substr() is going to be a problem for you? Have you bench-marked it? If your file is as large as you say, I strongly suspect that your bottleneck is going to be I/O and any diff

Re: Any alternative for substr() function

2013-04-10 Thread Ken Slater
p/ /g; ... } HTH, Ken On Wed, Apr 10, 2013 at 8:02 AM, kavita kulkarni wrote: > Data file has the lines with same length and so the field positions I am > interested in (so unpack works for me). > Tried with "unpack" as well & it takes almost same time as substr(). > > Here

Re: Any alternative for substr() function

2013-04-10 Thread David Precious
On Wed, 10 Apr 2013 08:45:40 -0700 Bob goolsby wrote: > Before you go off on a goose chase, how do you know that substr() is > going to be a problem for you? Have you bench-marked it? If your > file is as large as you say, I strongly suspect that your bottleneck > is going to be I/O and any dif

Re: Any alternative for substr() function

2013-04-10 Thread Bob goolsby
ame time as substr(). > > Here is sample code: > > Below function is called for each line of input data file.. > > sub extractFieldValue { > my $self = shift; > my $data = shift; #Line from data file > my $start = shift; > my $length = shift; > my $startPos = $st

Re: Any alternative for substr() function

2013-04-10 Thread kavita kulkarni
Data file has the lines with same length and so the field positions I am interested in (so unpack works for me). Tried with "unpack" as well & it takes almost same time as substr(). Here is sample code: Below function is called for each line of input data file.. sub extractFieldVa

Re: Any alternative for substr() function

2013-04-10 Thread Jenda Krynicky
From: timothy adigun <2teezp...@gmail.com> > On 10 Apr 2013 11:30, "Chankey Pathak" wrote: > > > > Hi Kavita, > > > > You may try unpack (http://perldoc.perl.org/functions/unpack.html) > > > unpack would not work if the OP has varying length of lines. Nope. It would work just fine as long as the

Re: Any alternative for substr() function

2013-04-10 Thread timothy adigun
each line of my file and store them in separate variables for further > > processing. > > My file size can vary from thousand to millions of lines. > > If I use perl in-built function substr() to data extraction, it has huge > > impact on performance. > > Is there any alternat

Re: Any alternative for substr() function

2013-04-10 Thread Chankey Pathak
t; > I want to extract certain char sets (e.g. char 4 to 9, char 11 to 14 etc.) > from each line of my file and store them in separate variables for further > processing. > My file size can vary from thousand to millions of lines. > If I use perl in-built function substr() to data ex

Any alternative for substr() function

2013-04-10 Thread kavita kulkarni
Hi All, I want to extract certain char sets (e.g. char 4 to 9, char 11 to 14 etc.) from each line of my file and store them in separate variables for further processing. My file size can vary from thousand to millions of lines. If I use perl in-built function substr() to data extraction, it has

Re: Retry function?

2012-12-13 Thread Charles DeRykus
On Thu, Dec 13, 2012 at 8:09 AM, Alvin Ramos wrote: > Any one have any suggestions of a module/function/method to write a perl > script to try pinging a server then after the 3rd time to send an email? > Thanks in advance... perldoc Net::Ping -- Charles DeRykus -- To unsubscrib

RE: Retry function?

2012-12-13 Thread Ned Cunningham
yes Thankx Ned -Original Message- From: Alvin Ramos [mailto:w...@theflux.net] Sent: Thursday, December 13, 2012 11:10 AM To: beginners@perl.org Subject: Retry function? Any one have any suggestions of a module/function/method to write a perl script to try pinging a server then after

Retry function?

2012-12-13 Thread Alvin Ramos
Any one have any suggestions of a module/function/method to write a perl script to try pinging a server then after the 3rd time to send an email? Thanks in advance... -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Re: Catfile function not working on windows 7 machine

2012-09-01 Thread Dr.Ruud
On 2012-08-08 12:17, Sandip Karale wrote: use File::Spec::Functions; my $f="foo.txt"; my $d="machdir"; Try: my $d = '//mach/dir'; print "$f \n"; print "$d \n"; print catfile($d,$f); -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: Catfile function not working on windows 7 machine

2012-08-09 Thread Paul Anderson
Per the message by Mr. Adigun, using a single quote instead of double quotes tells perl not to interpolate the string. That will prevent it from eating all those backslashes. Paul Anderson -- VE3HOP On 2012-08-09, at 8:53 AM, Sandip Karale wrote: > Hi Shlomi, > > Thanks for your re

Re: Catfile function not working on windows 7 machine

2012-08-09 Thread Sandip Karale
Hi Shlomi, Thanks for your reply. my $d="machdir"; This UNC path I'm getting from arguments, and then I want to process it. That is I want to concatenate the file name to it and open the file and print its contents. So your solution will not help. Sincerely, Sandip On Wed, Aug 8,

Re: Catfile function not working on windows 7 machine

2012-08-08 Thread timothy adigun
Hi, Please, check my comments below On 8/8/12, Sandip Karale wrote: > Hello , > > I'm new to perl. > > I am on windows 7 64 bit machine. with Strawberry Perl (64-bit) 5.14.2.1. > > *My Code:* > > use File::Spec::Functions; > my $f="foo.txt"; > my $d="machdir"; > Instead of the above,

Re: Catfile function not working on windows 7 machine

2012-08-08 Thread Shlomi Fish
Hi Sandip, On Wed, 8 Aug 2012 15:47:24 +0530 Sandip Karale wrote: > Hello , > > I'm new to perl. > > I am on windows 7 64 bit machine. with Strawberry Perl (64-bit) > 5.14.2.1. It's good that you are using Strawberry Perl. > > *My Code:* > > use File::Spec::Functions; > my $f="foo.txt"; >

Catfile function not working on windows 7 machine

2012-08-08 Thread Sandip Karale
Hello , I'm new to perl. I am on windows 7 64 bit machine. with Strawberry Perl (64-bit) 5.14.2.1. *My Code:* use File::Spec::Functions; my $f="foo.txt"; my $d="machdir"; print "$f \n"; print "$d \n"; print catfile($d,$f); *Output:* * * foo.txt mach\\dir \mach\dir\foo.txt *M

Re: a perl function that takes two arguments(rule1,rule2) and swaps them,the rules are iptable rules

2012-06-21 Thread Shawn H Corey
On 12-06-21 07:41 AM, Shlomi Fish wrote: Hi Balli, On Mon, 18 Jun 2012 23:23:19 -0700 (PDT) balli sudan wrote: this is my sample code friends### sub swap { ($rule1,$rule2=@_; my $old_rule="iptables -A INPUT -s 0/0 -i eth0 -d 192.168.2.1 -p TCP -j ACCEPT"; $temp = $old_rule; my $new_str=ip

Re: a perl function that takes two arguments(rule1,rule2) and swaps them,the rules are iptable rules

2012-06-21 Thread Shlomi Fish
Hi Balli, On Mon, 18 Jun 2012 23:23:19 -0700 (PDT) balli sudan wrote: > this is my sample code friends### > sub swap > { > ($rule1,$rule2=@_; > my $old_rule="iptables -A INPUT -s 0/0 -i eth0 -d 192.168.2.1 -p TCP -j > ACCEPT"; > $temp = $old_rule; > my $new_str=iptables -D INPUT rule_no > #

a perl function that takes two arguments(rule1,rule2) and swaps them,the rules are iptable rules

2012-06-21 Thread balli sudan
this is my sample code friends### sub swap { ($rule1,$rule2=@_; my $old_rule="iptables -A INPUT -s 0/0 -i eth0 -d 192.168.2.1 -p TCP -j ACCEPT"; $temp = $old_rule; my $new_str=iptables -D INPUT rule_no #now here we will add the desired rule number my $new_rule=iptables -I INPUT rulenumber-s 202

Re: Question on the function - hex

2012-04-12 Thread Uri Guttman
hex to be a hex string and convert to 22. When outside, perl interprets 0x16 as 22 which is passed to hex to produce 34. shawn has it correct here but i want to clarify things a bit. perl will see any literal beginning with 0x as a hex number and always convert that to an internal integer (no

Re: Question on the function - hex

2012-04-12 Thread Shawn H Corey
On 12-04-12 04:34 PM, Parag Kalra wrote: Why does the output of perl -e "print hex '0x160402'" differs from the output of perl -e "print hex 0x160402" EG: bash-3.2$ perl -e "print hex '0x160402'" 94489281538 $ perl -e "print hex 0x160402" 10189963531576 $ per

Question on the function - hex

2012-04-12 Thread Parag Kalra
Why does the output of perl -e "print hex '0x160402'" differs from the output of perl -e "print hex 0x160402" EG: bash-3.2$ perl -e "print hex '0x160402'" 94489281538 $ perl -e "print hex 0x160402" 10189963531576

Re: Which function to convert Hex to Character

2012-03-14 Thread Shawn H Corey
On 12-03-14 05:51 AM, Dr.Ruud wrote: On 2012-03-14 07:45, 周 文 wrote: I am looking for a function (subroutine) to convert Hex(Ascii code) to character. See perldoc -f hex and perldoc -f unpack. He will also need chr(). hex() converts a hex string to a number. chr() converts a number to a

Re: Which function to convert Hex to Character

2012-03-14 Thread Dr.Ruud
On 2012-03-14 07:45, 周 文 wrote: I am looking for a function (subroutine) to convert Hex(Ascii code) to character. See perldoc -f hex and perldoc -f unpack. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http

Which function to convert Hex to Character

2012-03-13 Thread 周 文
Hi,   I get a large file, some part of which is Ascii code, some are not. I am looking for a function (subroutine) to convert Hex(Ascii code) to character. What is it?   MONITORED MESSAGE: 02D1 4D05 0650 0002 00 19 BA2D 0004 00 00 00 00 00 0A 01 02 02 00 00 00 00 00 00 00 00 00 00 00 00 07

Re: split function

2011-12-17 Thread Brandon McCaig
a few other documents with something like /\$# (i.e., search forward in the pager). The rest is pretty self explanitory. He's using the printf function with a format string to create the name and value line output. HTH, -- Brandon McCaig Castopulence Software <https://www.castopulence

Re: split function

2011-12-16 Thread Chris Stinemetz
> > However I think it's more likely that you need /all/ of the data to be > output, so I suggest something like my program below. > > HTH, > > Rob > > > use strict; > use warnings; > > my @headers; > > while () { >  if (@headers) { >    my @data = split; >    for my $i (0 .. $#headers) { >      pr

Re: split function

2011-12-16 Thread thebarn...@gmail.com
split() splits on whitespace by default. so the "\s+/" is optional. $_ = "3 element array"; @words = split; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: split function

2011-12-16 Thread shawn wilson
On Thursday, December 15, 2011, Chris Stinemetz wrote: > > It isn't a company policy just circumstance. The unix box I'm using > doesn't support DNS nameserver lookup or a C compiler. > > I'm currently using Perl 5.6.1 which doesnt' support local::lib and I > can't install perlbrew to upgrade my

Re: split function

2011-12-16 Thread Shlomi Fish
Hi Chris, On Thu, 15 Dec 2011 15:29:08 -0600 Chris Stinemetz wrote: > > > > Is that your company's policy, or do you just lack root access? If it's the > > latter, then see the various resources at > > http://perl-begin.org/topics/cpan/ , > > so you can see how to install Perl modules from CPAN

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Is that your company's policy, or do you just lack root access? If it's the > latter, then see the various resources at http://perl-begin.org/topics/cpan/ , > so you can see how to install Perl modules from CPAN under your home > directory. > It isn't a company policy just circumstance. The u

Re: split function

2011-12-15 Thread Shlomi Fish
Hi Chris, On Thu, 15 Dec 2011 11:58:00 -0600 Chris Stinemetz wrote: > On Thu, Dec 15, 2011 at 10:42 AM, Dr.Ruud wrote: > > On 2011-12-14 05:43, Chris Stinemetz wrote: > > > >> I am trying to split the first element of an array by white space then > >> continue reading the rest of the file. > >>

RE: split function

2011-12-15 Thread Ken Slater
> To: Perl Beginners > Cc: Ken Slater; Chris Stinemetz > Subject: Re: split function > > On 15/12/2011 16:09, Ken Slater wrote: > > > > I have not been following this too closely, but I don't understand > the > > algorithm used to get the above ou

Re: split function

2011-12-15 Thread Chris Stinemetz
> > Tool completed successfully > Thank you Rob! This is what I was trying to accomplish. I'm going to have to research to find out exactly what you did. Thanks agian, Chris -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http:

Re: split function

2011-12-15 Thread Rob Dixon
On 15/12/2011 16:09, Ken Slater wrote: I have not been following this too closely, but I don't understand the algorithm used to get the above output. What is that Ken? If you don't understand the question then ask some questions of your own! I would have named it @fieldValues since arrays

Re: split function

2011-12-15 Thread Rob Dixon
On 15/12/2011 15:47, Chris Stinemetz wrote: > > I'm getting a bit closer. There a couple roadblocks I am up against. > > I am able to split the lines by white space, but for some reason the > program isn't capturing the first lines to the @fieldValue array after > the @headerNames array. > > Once I

RE: split function

2011-12-15 Thread Ken Slater
> -Original Message- > From: Ken Slater [mailto:kl...@psu.edu] > Sent: Thursday, December 15, 2011 11:09 AM > To: 'Chris Stinemetz'; 'John W. Krahn' > Cc: 'Perl Beginners' > Subject: RE: split function > > > -Original M

Re: split function

2011-12-15 Thread Chris Stinemetz
On Thu, Dec 15, 2011 at 10:42 AM, Dr.Ruud wrote: > On 2011-12-14 05:43, Chris Stinemetz wrote: > >> I am trying to split the first element of an array by white space then >> continue reading the rest of the file. >> Thus far I am having trouble figuring out how to split the first line. > > > You h

Re: split function

2011-12-15 Thread Dr.Ruud
On 2011-12-14 05:43, Chris Stinemetz wrote: I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. You have an XY problem, you are probably looking for http://search.c

RE: split function

2011-12-15 Thread Ken Slater
> -Original Message- > From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] > Sent: Thursday, December 15, 2011 10:47 AM > To: John W. Krahn > Cc: Perl Beginners > Subject: Re: split function > > I'm getting a bit closer. There a couple roadblocks I am

Re: split function

2011-12-15 Thread Chris Stinemetz
I'm getting a bit closer. There a couple roadblocks I am up against. I am able to split the lines by white space, but for some reason the program isn't capturing the first lines to the @fieldValue array after the @headerNames array. Once I get all the lines to go into the array correctly I would l

Re: split function

2011-12-14 Thread John W. Krahn
timothy adigun wrote: Hi Chris, Please check added code to yours, in addition to what John wrote; I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like

Re: split function

2011-12-14 Thread timothy adigun
Hi Chris, Please check added code to yours, in addition to what John wrote; I am trying to split the first element of an array by white space then continue reading the rest of the file. Thus far I am having trouble figuring out how to split the first line. I would like the first line to be spli

  1   2   3   4   5   6   7   8   9   10   >