Harry Putnam wrote:
"Joseph L. Casale" writes:
Is it required to manually close a file handle I used
to write debugging info to when the Perl scripts exits?
Seems like a waste of effort at the end of the script to
test `if debug...` and close the fh after?
Not required no... that is, it won
Parag Kalra writes:
> Hey All,
>
> I am trying to execute a Perl via shell script. I want to redirect output of
> Perl script to one file and error occured (if any) to other file.
>
> This is the snippet from my shell script:
>
> perl output_error.pl 1>> Report.log 2>>Error.log
>
> However even n
"Joseph L. Casale" writes:
> Is it required to manually close a file handle I used
> to write debugging info to when the Perl scripts exits?
>
> Seems like a waste of effort at the end of the script to
> test `if debug...` and close the fh after?
Not required no... that is, it won't cause an err
Steve Bertrand writes:
> First note that this will run forever :)
Yup... for a second there I thought I'd inadvertently pressed `y' at
the linux prompt...
> Also, there's no proper conditional logic involved here, the dispatch
> table subs are just calling back to other subs from within the di
On Apr 30, 3:55 am, learn.tech...@gmail.com (Amit Saxena) wrote:
> Hello everybody,
>
> Can we perform substitution to the matched pattern inside a regular
> expression so that the modified pattern gets returned instead of earlier
> matched one ?
>
> As a reference, in the following code below, I w
On Fri, April 30, 2010 1:07 pm, John W. Krahn wrote:
> Paul wrote:
>> OK, was kinda rust, been working on Solaris servers for year, but not
>> been
>> working solely with windows, but I sure do miss scripting, no matter how
>> screwed up my programming skills are, it's fun! Here is what I have
>>
Hey All,
I am trying to execute a Perl via shell script. I want to redirect output of
Perl script to one file and error occured (if any) to other file.
This is the snippet from my shell script:
perl output_error.pl 1>> Report.log 2>>Error.log
However even normal print messages are going to Erro
>> You can use the trick mentioned in 'perldoc -q string' "How do I expand
>> function calls in a string?"
Funny that the perldoc uses the exact function I wanted to use:)
>localtime is a Perl function, not an external command, so:
Thanks guys!
jlc
--
To unsubscribe, e-mail: beginners-unsubscr.
On 4/30/10 Fri Apr 30, 2010 9:55 AM, "Paul"
scribbled:
> On Fri, April 30, 2010 12:37 pm, Jim Gibson wrote:
>> If you do need to change '/' to '\':
>>
>> $path =~ s{ / }{\\}gx;
>
> I'll have to remember that when tr///d doesn't work! Thanks.
Why are you using the d modifier, which mea
Paul wrote:
OK, was kinda rust, been working on Solaris servers for year, but not been
working solely with windows, but I sure do miss scripting, no matter how
screwed up my programming skills are, it's fun! Here is what I have with
"\" replacing "/" and better fixes with counting. Yes, I know
Jim Gibson wrote:
On 4/30/10 Fri Apr 30, 2010 9:27 AM, "Joseph L. Casale"
scribbled:
Inside a here doc, how can I force an expression to be evaluated
such as localtime:
print <<"END";
`localtime time`
Foo
Bar
END
I know I can simply create the var before,
my $var = localtime time;
Bu
On Fri, April 30, 2010 12:37 pm, Jim Gibson wrote:
> On 4/30/10 Fri Apr 30, 2010 9:24 AM, "Paul"
> scribbled:
>
>> OK, it was late at night, and working 7 days/week doesn't help. Anyhow,
>> after looking at my convoluted script, I have one that works now, but am
>> now trying to figure out an e
OK, was kinda rust, been working on Solaris servers for year, but not been
working solely with windows, but I sure do miss scripting, no matter how
screwed up my programming skills are, it's fun! Here is what I have with
"\" replacing "/" and better fixes with counting. Yes, I know there is a
bet
On 4/30/10 Fri Apr 30, 2010 9:27 AM, "Joseph L. Casale"
scribbled:
> Inside a here doc, how can I force an expression to be evaluated
> such as localtime:
>
> print <<"END";
>
> `localtime time`
> Foo
> Bar
>
> END
>
>
> I know I can simply create the var before,
> my $var = localtime tim
C.DeRykus wrote:
Um, that won't do what you think. The () just tosses all
the return arg's and $name remains undefined because
of the list context.
my($name) = () = Function1($arg); # $name stays undef
If $name were in scalar context though, you'd get a count
of the arg's returned and thrown
On 4/30/10 Fri Apr 30, 2010 9:24 AM, "Paul"
scribbled:
> OK, it was late at night, and working 7 days/week doesn't help. Anyhow,
> after looking at my convoluted script, I have one that works now, but am
> now trying to figure out an easy way to change the "/" in the resultant
> file to "\" to
From: Paul
> OK, it was late at night, and working 7 days/week doesn't help.
Anyhow,
> after looking at my convoluted script, I have one that works now, but
am
> now trying to figure out an easy way to change the "/" in the
resultant
> file to "\" to work in windows. Always something.
Do you re
Is it required to manually close a file handle I used
to write debugging info to when the Perl scripts exits?
Seems like a waste of effort at the end of the script to
test `if debug...` and close the fh after?
Thanks!
jlc
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional
Inside a here doc, how can I force an expression to be evaluated
such as localtime:
print <<"END";
`localtime time`
Foo
Bar
END
I know I can simply create the var before,
my $var = localtime time;
But just curious how to evaluate expressions inside this...
Thanks!
jlc
--
To unsubscribe, e-
OK, it was late at night, and working 7 days/week doesn't help. Anyhow,
after looking at my convoluted script, I have one that works now, but am
now trying to figure out an easy way to change the "/" in the resultant
file to "\" to work in windows. Always something.
#user/bin/perl -w
use File::
On Thursday 29 Apr 2010, C.DeRykus wrote:
> Um, that won't do what you think. The () just tosses all
> the return arg's and $name remains undefined because
> of the list context.
>
> my($name) = () = Function1($arg); # $name stays undef
>
> If $name were in scalar context though, you'd get a c
Hi,
sorry for the late response.
On Wednesday 28 Apr 2010 20:12:36 Trev wrote:
> I'm trying to use Perl to replace a line in a few XML files I have.
>
> Example XML below, I'm wanting to change the Id= part from Id="/Local/
> App/App1" to Id=/App1". I know there's an easy way to do this with
>
On 29/04/2010 17.56, marcos rebelo wrote:
the code:
use v5.10;
use Modern::Perl;
use List::MoreUtils qw(any);
say( (any { $_ eq 7 } (0..10) ) or 'false' );
given (5) {
when (5) {
say( (any { $_ eq 7 } (0..10) ) or 'false' );
say( join(", ", map { $_ eq 7 } (0..10) ) );
Hi Raheel,
On Friday 30 Apr 2010 14:17:03 Raheel Hassan wrote:
> Hi Shlomi,
>
> I am very thankful to you for helping me, yes i resolved the problem
> actually perl-devel was missing. So when i executed 'urpmi perl-devel' i
> got EXTERN.h. Now i am able to install all the required packages from
>
HACKER Nora wrote:
If you do:
my ($var1) = @_;
You're doing list assignment and, as a result, you assign $var1 to the
$_[0]
and don't make use of $_[1], $_[2], $_[3], etc., which may or may not
exist.
Thanks, perfectly clear now.
In 'perldoc perlsub' I read that I only have to use
parenthe
Hello everybody,
Can we perform substitution to the matched pattern inside a regular
expression so that the modified pattern gets returned instead of earlier
matched one ?
As a reference, in the following code below, I want to perform the
substitution of "~" character with "_" character to the va
On Apr 29, 4:57 am, shawnhco...@gmail.com (Shawn H Corey) wrote:
> Akhthar Parvez K wrote:
> > Hi,
>
> > The following line stores the first return value by the function Function1
> > to the variable $name:
>
> > my ($name) = @_[0] = &Function1 ($arg);
>
> > but this one doesn't work:
> > my ($nam
Remy Guo wrote:
hi all,
I've got a problem in following script:
sub A {
our %a;
$a{"fred"} = 1;
$a{"bella"} = 2;
...
}
sub B {
if ($fred != $a{"fred"}) {
print "fred failed.\n";
}
if ($bella != $a{"bella"} {
print "bella failed.\n";
}
}
The problem
Trev wrote:
I'm trying to use Perl to replace a line in a few XML files I have.
Example XML below, I'm wanting to change the Id= part from Id="/Local/
App/App1" to Id=/App1". I know there's an easy way to do this with
perl alone however I'm trying to use XML::Simple or any XML plugin for
perl.
I think it's a bug in "any" ...
Try this:
my $_ = 5;
say( (any { $_ eq 7 } (0..10) ) or 'false' );
given (5) {
when (5) {
say( (any { our $_ eq 7 } (0..10) ) or 'false' );
say( join(", ", map { $_ eq 7 } (0..10) ) );
}
}
and it prints:
false
1
, , , , , , , 1, , ,
B
Hi Shlomi,
> Because the lack of parenthesis signifies that the right-hand-side
will
> be
> done in scalar context. As a result it is equivalent to:
>
> my $var1 = scalar(@_);
>
> Which is the length of the @_ array (which sometimes have some valid
> uses if
> you're checking for optional argum
Hi Nora,
On Friday 30 Apr 2010 09:55:33 HACKER Nora wrote:
> Hi,
>
> For calling subroutines and passing arguments on I use e.g.
>
> my ( $var1, $var2 ) = @_;
>
> If I have only one argument, this is also ok:
>
> my ( $var1) = @_;
>
> But why does
>
> my $var1 = @_;
>
> not work?
Because
32 matches
Mail list logo