help with fetching the values from perlscript


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help with fetching the values from perlscript
# 1  
Old 06-27-2011
help with fetching the values from perlscript

Hi,

I have a perl script abc.pl..
Code:
#!/usr/bin/perl
 
    local ($buffer, @pairs, $pair, $name, $value, %FORM);
    # Read in text
    $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
    if ($ENV{'REQUEST_METHOD'} eq "POST")
    {
        read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    }else {
        $buffer = $ENV{'QUERY_STRING'};
    }
    # Split information into name/value pairs
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs)
    {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%(..)/pack("C", hex($1))/eg;
        $FORM{$name} = $value;
    }
    if( $FORM{Q1} ){
        $Q1_flag ="ON";
    }else{
        $Q1_flag ="OFF";
    }
    if( $FORM{Q2} ){
        $Q2_flag ="ON";
    }else{
        $Q2_flag ="OFF";
    }
 
    if( $FORM{Q3} ){
        $Q3_flag ="ON";
    }else{
        $Q3_flag ="OFF";
    }
 
    if( $FORM{Q4} ){
        $Q4_flag ="ON";
    }else{
        $Q4_flag ="OFF";
    }
 
    if( $FORM{Q5} ){
        $Q5_flag ="ON";
    }else{
        $Q5_flag ="OFF";
    }

This script has five variables(Q1_flag, Q2_flag,Q3_flag,Q4_flag and Q5_flag) whose value will be assigned from an html page.

Now I need help in writing a script which fetches the values of these variables and put them in one string(each answer seperated by Smilie..
Any help is highly appreciated.

Thanks a ton in advance.

Last edited by Franklin52; 06-27-2011 at 04:10 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 06-27-2011
???
Code:
print "$Q1_flag;$Q2_flag;...\n"

# 3  
Old 06-27-2011
hi yazu,

thanks for the reply.

I want to know how to write a script which refers to the existing abc.pl script and fetches the values of the variables assigned in abc.pl

Thanks again..
# 4  
Old 06-27-2011
Quote:
I want to know how to write a script which refers to the existing abc.pl script and fetches the values of the variables assigned in abc.pl
I want to know too... Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Fetching data from file

Hi All, I'm facing issue while using script. Chk_Etl_Status=`cat /dstage/questnet/qnetdv/input/Etl_Status.dat|cut -d"," -f1` echo Chk_Etl_Status=$Chk_Etl_Status above result is giving me sometime value as 1 and sometime error message as Chk_Etl_Status= dsjoblaunch.sh: test: Specify a... (5 Replies)
Discussion started by: Amit786
5 Replies

2. Shell Programming and Scripting

Fetching values in CSV file based on column name

input.csv: Field1,Field2,Field3,Field4,Field4 abc ,123 ,xyz ,000 ,pqr mno ,123 ,dfr ,111 ,bbb output: Field2,Field4 123 ,000 123 ,111 how to fetch the values of Field4 where Field2='123' I don't want to fetch the values based on column position. Instead want to... (10 Replies)
Discussion started by: bharathbangalor
10 Replies

3. Shell Programming and Scripting

Extracting fetching values

I have a file like this ############################################ # ParentFolder Flag SubFolders Colateral 1 Source1/Checksum CVA 1 Source1/Checksum Test 1 VaR/Checksum Test2 1 SVaR/Checksum FX 1 ... (6 Replies)
Discussion started by: manas_ranjan
6 Replies

4. Shell Programming and Scripting

catch a particular word from a specific line -perlscript

Hi, App.log contains the data- ================================================= Value of DsRef =null Recovery File exixts Recovered readFile 20110509 17:00:00.369019 +0100s The DsRef Recovered from Recovery.txt file : 20110509 17:00:00.369019 +0100 Recovered from Recovery.txt file... (2 Replies)
Discussion started by: pspriyanka
2 Replies

5. Shell Programming and Scripting

Error in fetching multiple row values into variables

Hello Team, In the below code....The variabe values are not fetch from input table into SELECT statements. =========================== #!/usr/bash DATABASE=XXXXX inputFILE=$1 db2 connect to $DATABASE TABLENAME=`echo $inputFILE|awk '{print $1}'` COLUMNNAME=`echo $inputFILE|awk... (2 Replies)
Discussion started by: rocking77
2 Replies

6. Shell Programming and Scripting

Fetching just the matching pattern

Hi Everybody, I would like you to help me with the following problem. Given is a path to a file like this: /root/DIR/subdir/file.dat Having this path I would like to grep/sed or whatever the directory string that matches the following pattern ''. I just need the matching directory... (5 Replies)
Discussion started by: hhoosscchhii
5 Replies

7. Shell Programming and Scripting

fetching values using awk and storing into array

hi all I am using awk utility to parse the file and fetching two different vaues from two different record of a record set. I am able to see the result, now i want to store the result and perform some check of each values form database to mark valid and invalid. could you please help me... (3 Replies)
Discussion started by: singhald
3 Replies

8. UNIX Desktop Questions & Answers

Fetching unique values from file

After giving grep -A4 "feature 1," <file name> I have extracted the following text feature 1, subfeat 2, type 1, subtype 5, dump '30352f30312f323030392031313a33303a3337'H -- "05/01/2009 11:30:37" -- -- ... (1 Reply)
Discussion started by: shivi707
1 Replies

9. Shell Programming and Scripting

execute shell command in perlscript

Hi I have this below script...I want to execute the shell command "rm" in the below script but it is not working. Can anybody why so? I got the below error rm: /users/amvarma is a directory sh: /*-log*: not found ------------------- $u=`whoami`; print "$u\n"; $op_1=$ARGV; # for... (0 Replies)
Discussion started by: amitrajvarma
0 Replies
Login or Register to Ask a Question