Re: convert binary to hex

2009-12-09 Thread Brandon Wood
You may want to chomp the line to remove the newline character. After' my $line = $_;' add: chomp $line; On Wed, Dec 9, 2009 at 10:16 PM, Majian wrote: > Hi ,all : > > I'd like to convert binary file intohex , but when I use perl's built > in functions I keep getting extra bits on the end

convert binary to hex

2009-12-09 Thread Majian
Hi ,all : I'd like to convert binary file intohex , but when I use perl's built in functions I keep getting extra bits on the end. cat bin_file 11100010 0001010100111110 My perl script is the following : #!/usr/bin/perl use strict; while (<>){

Re: matching an element from one array to another

2009-12-09 Thread John W. Krahn
Rafa? Pocztarski wrote: I forgot to cc: the list... 2009/12/10 Noah : I am hoping to figure out the best Way to write something. Â I have two arrays @previous_hostnames and @hostnames. I want to figure out if there is at least one matching element in @previous_hostnames that is found in @hostn

Re: Can I design a website using Perl

2009-12-09 Thread Rafał Pocztarski
2009/12/6 Parag Kalra : > I have only interacted with PHP/MySQL to design a website. > > I wanted to know if it is possible to use Perl instead of PHP (and I am > pretty sure it should be possible :) ). But my main concern is what are the > main Pros & Cons of using Perl instead of PHP. Hi, While

Re: passing command-line arg containing '@'

2009-12-09 Thread Jim Gibson
On 12/9/09 Wed Dec 9, 2009 6:01 PM, "Tony Esposito" scribbled: > I need to pass an command-line arg that is a string which contains the '@'. > Is there any way to do this and also 'tell' Perl not to interpret this as > other than a '@' character? The '@' character is only special in Perl sourc

Re: matching an element from one array to another

2009-12-09 Thread Uri Guttman
> "N" == Noah writes: N> Hi there, N> I am hoping to figure out the best Way to write something. I have two N> arrays @previous_hostnames and @hostnames. N> I want to figure out if there is at least one matching element in N> @previous_hostnames that is found in @hostnames. N>

Re: Feedback, please

2009-12-09 Thread Uri Guttman
> "AHA" == Alan Haggai Alavi writes: >> Hello, >> >> I would like to have someone looking over my script, which is a basic >> frontend for playing radio with mplayer. In particular, I'm wondering how I >> could get rid of all those elsif's when parsing the arguments; as you can >

passing command-line arg containing '@'

2009-12-09 Thread Tony Esposito
I need to pass an command-line arg that is a string which contains the '@'. Is there any way to do this and also 'tell' Perl not to interpret this as other than a '@' character? Thx.

Re: matching an element from one array to another

2009-12-09 Thread Rafał Pocztarski
I forgot to cc: the list... 2009/12/10 Noah : > I am hoping to figure out the best Way to write something.  I have two > arrays @previous_hostnames and @hostnames. > > I want to figure out if there is at least one matching element in > @previous_hostnames that is found in @hostnames. You can use

Re: matching an element from one array to another

2009-12-09 Thread John W. Krahn
Noah wrote: Hi there, Hello, I am hoping to figure out the best Way to write something. I have two arrays @previous_hostnames and @hostnames. I want to figure out if there is at least one matching element in @previous_hostnames that is found in @hostnames. my $found = map { my $x = $_;

matching an element from one array to another

2009-12-09 Thread Noah
Hi there, I am hoping to figure out the best Way to write something. I have two arrays @previous_hostnames and @hostnames. I want to figure out if there is at least one matching element in @previous_hostnames that is found in @hostnames. What about finding all matching elements. I suppose

Re: Getting USER env variable in Windows -- How to?

2009-12-09 Thread Ron Bergin
On Dec 9, 7:01 am, tony1234567...@yahoo.co.uk (Tony Esposito) wrote: > I need to get the current USER env var in a Windows Perl program.  Does > anyone know how this is done?  I have done it on UNIX/Linux. > > Thx. perl -e "print $ENV{'USERNAME'}" -- To unsubscribe, e-mail: beginners-unsubscr..

RE: Getting USER env variable in Windows -- How to?

2009-12-09 Thread Bob McConnell
From: Tony Esposito > I need to get the current USER env var in a Windows Perl > program.  Does anyone know how this is done?  I have done > it on UNIX/Linux. I believe it is labeled USERNAME in the MS-Windows environment. Bob McConnell -- To unsubscribe, e-mail: beginners-unsubscr...@perl.or

Getting USER env variable in Windows -- How to?

2009-12-09 Thread Tony Esposito
I need to get the current USER env var in a Windows Perl program.  Does anyone know how this is done?  I have done it on UNIX/Linux. Thx.

Re: Email does not send attachment ...

2009-12-09 Thread Tony Esposito
Thanks to all.  I abandoned MIME::Lite in favor Mail::Sender and got it to work fine. From: Philip Potter To: "beginners@perl.org" Sent: Wed, 9 December, 2009 6:06:01 Subject: Re: Email does not send attachment ... 2009/12/9 Sneed, Sean P : > Try the paths li

Re: Email does not send attachment ...

2009-12-09 Thread Philip Potter
2009/12/9 Sneed, Sean P : > Try the paths like this C:\\my_file.log Is there a reason that you suggested this? Perl under Windows, just like C and C++ under Windows, accepts / as a directory separator just fine. And if you stick to using / as your directory separator, porting to unix-based systems

Re: About the perl index function question

2009-12-09 Thread Alan Haggai Alavi
Hi, index $s, "e", 3; This means "position of the first 'e' on or after position 3". The position of the 'e' is counted from the start of the string. Counting starts from 0. Regards, Alan Haggai Alavi. -- The difference makes the difference. -- To unsubscribe, e-mail: beginners-unsubscr...@p

Re: Feedback, please

2009-12-09 Thread Alan Haggai Alavi
>Hello, > >I would like to have someone looking over my script, which is a basic >frontend for playing radio with mplayer. In particular, I'm wondering how I >could get rid of all those elsif's when parsing the arguments; as you can >see, there's lots of them, and I suspect that there's a better wa

RE: Email does not send attachment ...

2009-12-09 Thread Sneed, Sean P
Try the paths like this C:\\my_file.log -Original Message- From: Robert H [mailto:sigz...@gmail.com] Sent: Tuesday, December 08, 2009 6:58 PM To: beginners@perl.org Subject: Re: Email does not send attachment ... On 12/8/09 3:56 PM, Tony Esposito wrote: > Hello, > > I am using Per

Re: Email does not send attachment ...

2009-12-09 Thread C.DeRykus
On Dec 8, 12:56 pm, tony1234567...@yahoo.co.uk (Tony Esposito) wrote: > Hello, > > I am using Perl 5.8 on WindowsXP and Windows Server 2003.  I can not get the > following attachment to arrive/attach even though I get the email with no > issues.  Any ideas? > > ... > >   MIME::Lite->send('smtp',

Re: Eval scoping question

2009-12-09 Thread C.DeRykus
On Dec 8, 12:08 am, an...@melerit.se (Anders Hartman) wrote: > Hello, > > I which to use eval to execute subroutines dynamically. > > The following code snippet fails: > > #!/usr/bin/perl > > use strict; > use warnings; > > sub asub { >    our $abc; >    print $abc; > > } > > my $abc = "abc\n"; > e

Re: could not execute psexec

2009-12-09 Thread C.DeRykus
On Dec 7, 9:11 pm, perl...@gmail.com (Perl Pra) wrote: > Hi All, > > I have done the following. > > printed the cmd variable and check what actually got passed. If I copy paste > the printed command on dos prompt it worked fine. > > I think its not intallation issues as I could execute the command

Re: newline regexes

2009-12-09 Thread jackassplus
> It removes all singly occurring newlines. > > This is a negative, zero-width, look-behind assertion (? means that the variable does not match what it contains, in this case a > newline, before the match but do not include what it matches in the match. > > This is a negative, zero-width, look-ahe

Re: Email does not send attachment ...

2009-12-09 Thread Dermot
2009/12/9 Robert H : > On 12/8/09 3:56 PM, Tony Esposito wrote: >> >> Hello, Hi >>   use MIME::Lite; >>  use Net::SMTP; >> >>  unless (-e 'C:/my_file.log'&&  -s 'C:/my_file.log' ) { print "file not >> found\n"; } >> >>   my $msg = MIME::Lite->new ( >>     From =>  'my_em...@yahoo.com', >>     To =

Re: passing Hash to subroutine help please

2009-12-09 Thread Philip Potter
2009/12/9 John W. Krahn : > Jeff Pang wrote: >> >> Noah: >>> >>> sub exiting { >>>    my ($hostname, %login) = @_; >> >> Passing arguments like this has no such problem. >> But you'd better pass the hash as a reference to the subroutine. >> >> exitint($hostname, \%login); >> >> sub exiting { >>