Re: global and local confusion

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 15:33, Harry Putnam <[EMAIL PROTECTED]> wrote: snip > ChasO, I'm curious about something here. I noticed you put: > use File::Find; > use File::MMagic; > > Before the checkfile() call. > > In the actual working script where checkfile() will be only a minor > part it is li

Re: global and local confusion

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 14:41, Harry Putnam <[EMAIL PROTECTED]> wrote: snip > It looks like what you've done is pass an entire sub function into > another sub function. So there ends up being 3 sub function in all. > > I see it works but I'm still a little confused about `wanted()'. > > Is it not

Re: global and local confusion

2008-11-24 Thread Harry Putnam
"Chas. Owens" <[EMAIL PROTECTED]> writes: > use strict; > use warnings; > > use File::Find; > use File::MMagic; > > my $flag = shift; > > checkfile($flag); ChasO, I'm curious about something here. I noticed you put: use File::Find; use File::MMagic; Before the checkfile() call. In the actu

Re: perl version for windows

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 10:34, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > From: "Chas. Owens" <[EMAIL PROTECTED]> >> On Sun, Nov 23, 2008 at 19:39, Rob Dixon <[EMAIL PROTECTED]> wrote: >> snip >> >> All Perl functionality works on UNIX. Some Perl functionality does >> >> not work on Windows. >> >

Re: global and local confusion

2008-11-24 Thread Harry Putnam
"John W. Krahn" <[EMAIL PROTECTED]> writes: > Harry Putnam wrote: [...] >> Variable "$rgx" will not stay shared at ./test line 30. > > perldoc perldiag > [ snip ] > > Variable "%s" will not stay shared > (W closure) An inner (nested) named subroutine is referencing a > lexi

Re: global and local confusion

2008-11-24 Thread Harry Putnam
"Chas. Owens" <[EMAIL PROTECTED]> writes: >> I don't understand why that happens. >> [snip] my version of script > It looks like your problem is that you are creating a named subroutine > inside another. > > I think this is close to what you desire. Yes, and I see you were able to come very cl

getting error when running Net::SSH2

2008-11-24 Thread monnappa appaiah
Hi all, I'm running kubuntu linuxI used Net::SSH2 to login to remote machine, execute commands and give me the ouput...when i run the below code i get this error "Segmentation fault"...does anybody have an idea wat this error is?

Re: getting error when running Net::SSH2

2008-11-24 Thread Stealth
On Monday 24 November 2008 02:12:08 pm Stealth wrote: > On Monday 24 November 2008 01:58:33 pm monnappa appaiah wrote: > > Hi all, > > > >I'm running kubuntu linuxI used > > Net::SSH2 to login to remote machine, execute commands and give > > me the ouput...when i run the

Re: getting error when running Net::SSH2

2008-11-24 Thread Stealth
On Monday 24 November 2008 01:58:33 pm monnappa appaiah wrote: > Hi all, > >I'm running kubuntu linuxI used Net::SSH2 > to login to remote machine, execute commands and give me the > ouput...when i run the below code i get this error > "Segmentation fault"...does

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 16:34 +0100, Jenda Krynicky wrote: > Is there any reason you want to do that? Other than that some > braindead languages work that way? Complete evaluation of conditions > is one of the most annoying features of any language. > > If rstBlah.EOF Then > bla bla bla > ElseIf

Re: Regarding conditional statement

2008-11-24 Thread suresh kumar
Thanks for the response. but is there anyother way to do this? On Mon, Nov 24, 2008 at 6:40 PM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote: > On Mon, 2008-11-24 at 16:11 +0530, suresh kumar wrote: > > Hi, > > > > Here is the sample code: > > > > sub a { > > print "i am a\n"; > > return 0; > > }

Re: Regarding conditional statement

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 08:15, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > On Mon, 2008-11-24 at 18:41 +0530, suresh kumar wrote: >> Thanks for the response. >> >> but is there anyother way to do this? >> > > You just got three answer all essentially the same. What's wrong with > them? snip W

Re: Uninitialized value in array

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 10:05, John W. Krahn <[EMAIL PROTECTED]> wrote: > sanket vaidya wrote: >> >> Hi all, > > Hello, > >> Kindly look at the code below: >> >> my ($bi, $bn, @bchrs); > > $bi starts out at 0. > >> my $boundry = ""; >> foreach $bn (48..57,65..90,97..122) { >> >> $bchrs[$bi++]

Re: perl version for windows

2008-11-24 Thread Jenda Krynicky
From: "Chas. Owens" <[EMAIL PROTECTED]> > On Sun, Nov 23, 2008 at 19:39, Rob Dixon <[EMAIL PROTECTED]> wrote: > snip > >> All Perl functionality works on UNIX. Some Perl functionality does > >> not work on Windows. > > > > No, not all Perl functionality works on all Unix platforms. You are as > >

Re: Regarding conditional statement

2008-11-24 Thread Jenda Krynicky
From: "suresh kumar" <[EMAIL PROTECTED]> > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > print "yes\n"; > } else { > print "no\n"; > } > > > > I want both the subroutine to be executed, and then

Re: how to read file content into an array?

2008-11-24 Thread Chas. Owens
On Mon, Nov 24, 2008 at 07:24, loody <[EMAIL PROTECTED]> wrote: snip > My question are: > Q1: > what is the differences of using > "use bytes; use open IN => ":bytes";" > and "binmode "? snip The bytes pragma changes how string functions work (char vs byte, some chars take up more than one byte).

Fwd: Date format search in the file

2008-11-24 Thread Dermot
2008/11/22 sftriman <[EMAIL PROTECTED]>: > On Nov 22, 6:16 am, [EMAIL PROTECTED] (Dermot) wrote: >> 2008/11/22 Sureshkumar M (HCL Financial Services) <[EMAIL PROTECTED]>: >> I could be wrong but I don't think \w will not match a hypen "-" so >> the test will fail. >> This works for me: >> >> if ($

Re: Uninitialized value in array

2008-11-24 Thread John W. Krahn
sanket vaidya wrote: Hi all, Hello, Kindly look at the code below: my ($bi, $bn, @bchrs); $bi starts out at 0. my $boundry = ""; foreach $bn (48..57,65..90,97..122) { $bchrs[$bi++] = chr($bn); $bchrs[ 0 ] is assigned a value and then $bi is incremented to 1. print "$bchr

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 16:11 +0530, suresh kumar wrote: > Hi, > > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > print "yes\n"; > } else { > print "no\n"; > } > > > > I want both the subroutine t

Re: Uninitialized value in array

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 15:57 +0530, sanket vaidya wrote: > my ($bi, $bn, @bchrs); > > my $boundry = ""; > > foreach $bn (48..57,65..90,97..122) { > > > > $bchrs[$bi++] = chr($bn); > > print "$bchrs[$bi]"; > > } > > Output: > > Use of unitialized value within @bchrs > You incr

Re: Regarding conditional statement

2008-11-24 Thread Mr. Shawn H. Corey
On Mon, 2008-11-24 at 18:41 +0530, suresh kumar wrote: > Thanks for the response. > > but is there anyother way to do this? > You just got three answer all essentially the same. What's wrong with them? -- Just my 0.0002 million dollars worth, Shawn The map is not the territory, the do

Re: Regarding conditional statement

2008-11-24 Thread Dr.Ruud
"suresh kumar" schreef: > I want both the subroutine to be executed, and then i want print > some statements depending upon both the results. my $all = 1; a() or $all = 0; b() or $all = 0; c() or $all = 0; if ($all) { ... } -- Affijn, Ruud "Gewoon is een tijger."

RE: Regarding conditional statement

2008-11-24 Thread Stewart Anderson
> -Original Message- > From: suresh kumar [mailto:[EMAIL PROTECTED] > Sent: 24 November 2008 10:41 > To: beginners@perl.org; [EMAIL PROTECTED]; Amit Saxena > Subject: Regarding conditional statement > > Hi, > > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } >

Re: Regarding conditional statement

2008-11-24 Thread David Schmidt
my $ret_a = a(); my $ret_b = b(); if ($ret_a && $ret_b) { (...) } On Mon, Nov 24, 2008 at 11:41 AM, suresh kumar <[EMAIL PROTECTED]> wrote: > Hi, > > Here is the sample code: > > sub a { > print "i am a\n"; > return 0; > } > > sub b { > print "i am b\n"; > return 1; > } > > if (a() && b()) { > pr

Regarding conditional statement

2008-11-24 Thread suresh kumar
Hi, Here is the sample code: sub a { print "i am a\n"; return 0; } sub b { print "i am b\n"; return 1; } if (a() && b()) { print "yes\n"; } else { print "no\n"; } I want both the subroutine to be executed, and then i want print some statements depending upon both the results. here if a() ret

Re: how to read file content into an array?

2008-11-24 Thread loody
> You may also want to look into the pack** and unpack*** functions if you are > going to be messing around with binary files. > Dear all: I excerpt from web, http://coding.derkeiler.com/Archive/Perl/perl.beginners/2004-05/0150.html, and add them in my source code which looks like below: #!/usr/bi

Uninitialized value in array

2008-11-24 Thread sanket vaidya
Hi all, Kindly look at the code below: my ($bi, $bn, @bchrs); my $boundry = ""; foreach $bn (48..57,65..90,97..122) { $bchrs[$bi++] = chr($bn); print "$bchrs[$bi]"; } Output: Use of unitialized value within @bchrs Now when same code is written as my ($bi, $b

Re: global and local confusion

2008-11-24 Thread Harry Putnam
"Mr. Shawn H. Corey" <[EMAIL PROTECTED]> writes: [...] >> >> find(\&wanted, @finddir) or die " Failed to open >> finddir <$finddir>: $!"; > > You have not defined the scalar $finddir. You have defined the array > @finddir, but it's not the same. Sorry, yes you're right but I actually cau

RE: help in redirecting output to file

2008-11-24 Thread Jeff Pang
> Message du 24/11/08 08:23 > De : [EMAIL PROTECTED] > A : [EMAIL PROTECTED], beginners@perl.org > Copie à : > Objet : RE: help in redirecting output to file > > > Thanks but I need STD output and STD error in the same file. How should I do > that. > open STDERR, ">&STDOUT" or die "Can't dup