Eric Krause wrote:
Hello all,
Hello,
I have two quick questions that I would love some help on. I have looked
at the manual (Programming Perl) and I didn't get it, hence my email.
Question 1 - How can I make variables in a function (subroutine) global
(accessible from other functions)?
A
On Mon, 2008-12-22 at 15:18 -0700, Eric Krause wrote:
> Hello all,
> I have two quick questions that I would love some help on. I have looked
> at the manual (Programming Perl) and I didn't get it, hence my email.
>
> Question 1 - How can I make variables in a function (subroutine) global
> (acc
sheesh - that's a lot easier then the way I do it :P
thanks.
~Eric
On Tuesday, April 2, 2002, at 07:09 PM, John W. Krahn wrote:
> Glenn Cannon wrote:
>>
>> Hi all,
>
> Hello,
>
>> Couple of questions from a newbie...
>>
>> 1) How can I print the current directory name?
>
> use Cwd;
> my $dir =
Glenn Cannon wrote:
>
> Hi all,
Hello,
> Couple of questions from a newbie...
>
> 1) How can I print the current directory name?
use Cwd;
my $dir = cwd;
print "The current directory is $dir\n";
> 2) How can I check to see if a file I know the name of exists?
if ( -e $filename ) {
pri
PROTECTED]
Subject: Re: 2 questions
Glenn..
to print the current directory name...try
---
#!/usr/bin/perl -w
use strict;
use Cwd;
$curr = cwd();
print "$curr\n";
easy enough
this is bit longer example.. you could prolly do it another way..but
this is how *I* would do it
---
#!/usr/b
Glenn..
to print the current directory name...try
---
#!/usr/bin/perl -w
use strict;
use Cwd;
$curr = cwd();
print "$curr\n";
easy enough
this is bit longer example.. you could prolly do it another way..but
this is how *I* would do it
---
#!/usr/bin/perl -w
use strict;
use Cwd;
my $cur
--- Naveen Parmar <[EMAIL PROTECTED]> wrote:
> 1) How do you define global & lexical variables in Perl?
> 2) Is the arrow (->) a commonly used Perl operator?
>
> TIA,
> - NP
Global variables may be defined in several different manners.
1. Fully qualified with package name:
package Foo;
All variables are global in nature unless you declare them in a lexical
scope.
$foo = "Hello Naveen";
if ( 1 ) {
my $x = 1;
}
In this example $foo is global, and $x is local to the if-block only.
And yes, -> is used quite often when you start using references or classes
(a module that acts l
1) if you open it from a shell and type "perl" infront of the file name it
will keep it.
2) I could be wrong, but I think "" = nothing and "<>" = diamond operator
which is used to take input. i.e.
while (<>) {
$_ = $firstLineOfFile
}
-Original Message-
From: N
:34 PM
To: Naveen Parmar; [EMAIL PROTECTED]
Subject: RE: 2 Questions
> 1) Double clicking my Perl file within Windows Explorer opens within the DOS
> window, but then closes immediately after execution.
>
> It flashes up on the screen and closes itself. Can I prevent this auto
&
> 1) Double clicking my Perl file within Windows Explorer opens within the DOS
> window, but then closes immediately after execution.
>
> It flashes up on the screen and closes itself. Can I prevent this auto
> termination?
`pause`;
or:
system "pause";
Although pause is not documented in eithe
On Thu, 18 Oct 2001, Amit Joshi wrote:
> Q1: Do we have a standard way to generate random numbers in perl ?
perldoc -f rand
perldoc -q random
> Q2: How do we run system commands from a perl program ?
perldoc -f system
perldoc -q system
(perldoc -f gives you information on the usage of a speci
12 matches
Mail list logo