Question: When a user opens the page there is a count variable which increments by one. The count variable as well as the data are written in a file. 

The problem concerns the session variable which is not incrementing. Every time the page loads there should be a increment in the session which should be put into the file.

```
<?php
session_start();
$count=1;
if(!isset($_POST['submit'])){
    $txt = "abc.txt"; 
    $_SESSION["hello"] = $count++;
    if (isset($_POST['field1']) && isset($_POST['field2'])) { 
        $_SESSION["favanimal"] = "cat";
        $fh = fopen($txt, 'a'); 
        $txt=$a . '-' .$_POST['field1'].' - '.$_POST['field2']; 

        fwrite($fh,$txt); // Write information to the file
        fclose($fh); // Close the file

    }
    echo $_SESSION["hello"];
}

?>

```

HTML code is:

```
<form action="index.php" method="POST">
    <input name="field1" type="text" />
    <input type="submit" name="submit" value="Save Data">
</form>

```

Answer: 
You should change the last line:

```
#!/bin/sh
# run:  $ ./normalize x y input_file output_file
X=$1
Y=$2
INPUT=$3
OUTPUT=$4

BIGGEST_FIRST_COLUMN=$(sort -nrk1 $INPUT | head -n1 | cut -d ' ' -f 1)
BIGGEST_SECOND_COLUMN=$(sort -nrk2 $INPUT | head -n1 | cut -d ' ' -f 2)

PERL_CMD="'s!([\d.]+)\s([\d.]+)!(\$1/$BIGGEST_FIRST_COLUMN*$X).\" \".(\$2/$BIGGEST_SECOND_COLUMN*$Y)!e'"

CMD="perl -pe $PERL_CMD $INPUT > $OUTPUT"
echo "Run the following cmd : "
echo $CMD

# $CMD  < no
eval $CMD

```
Here's a Perl one-liner that will do as you ask without needing the shell to preprocess the data

```none
perl -MList::Util=max -E'@d=map[split],<>;for $i(0,1){$m=max map $$_[$i],@d; $$_[$i]*=10/$m for @d} say qq{@$_} for @d' data.txt

```

### output

```
10 5
7.5 10

```