I don't fully understand variables in perl.
If we have a variable defined like this "my $number = 1" then this is called a lexical variable? But if you define this at the top of a script then why isn't it a global variable because it would be available throughout the file?
Sorry if this is a really stupid question to ask but I'm getting myself confused.
Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect.
Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is
redirected to welcome page.
My requirement is, the welcome page should display the username.
Hello All,
This is my first script in PERL. Hence require your help in moving further.
I have a script which should populate the values for Today, Yesterday output.
For which I use timeFrame as a variable to obtain the time in hrs:mm as 10:00.
All I want is, I want my timeFrame to start with 00:00 and end with with my current timestamp.
Hi,
Is it possible in perl to have a hash defined with variables as theirs key values, like:
%account = ('username' => 'boy', 'password' => $password);
Thanks
Hi,
I have a perl script that takes in 2 numerical values as ARGV[].
Code:
perl script.pl parameter1 num1 num2
in my case I have 1000's of num1 and num2. I can have them in separate files. Please let me know how to automate this run using shell scripting or using awk, so that I don't have to enter all the values.
if you have something like:
find . -d -maxdepth 1 | wc -l | perl ...
what ways do you have to tell perl to take this variable that's coming its way and substract 1?
I try to substract 1 since find is counting 1 too much.
Hi,
I have been thinking of how to script this but i have no clue at all..
Could someone please help me out or give me some idea on this?
I would like to group those lines with the same first variable in each line, joining the 2nd variables with commas.
Let's say i have the following input.
Code:
aa c1
aa c2
aa c3
cc d1
dd e1
dd e2
ee f1
I would like the output to be like this.
Code:
aa
In the Perl documentation, perlrun(1) suggests launching Perl scripts using a bilingual shell/Perl header:
#!/bin/sh
#! -*-perl-*-
eval 'exec perl -x -wS $0 ${1+"$@"}'
if 0;
What does ${1+"$@"} mean? I tried using "$@" instead (using Bash as /bin/sh), and it seems to work just as well.
Edit
Two answers below say that it's supposed to be ${1:+"$@"}.
Greetings all,
If I have a SH script that calls a PERL script in the following way:
Code:
perl $HOME/scripts/config.properties
And in the config.properties PERL file, this Perl script only sets a number of environmental parameters in the following way:
Code:
#!/usr/bin/perl
$VAR1 = (
'PECOSSource' => '/opt/tibco/incoming',
'PECOSDestination' =>