http://qs1969.pair.com?node_id=342793

mvam has asked for the wisdom of the Perl Monks concerning the following question:

i'm trying to create a form for my script output so my manager can understand it. i've been able to get the data i want printed to the screen but it looks something like this:
URI Date Seconds Fil +e Size ----------------- --------------------- ------- --- +------ /profileQuery [05/Apr/2004:16:31:06 1 +885 URI Date Seconds Fil +e Size ----------------- --------------------- ------- --- +------ /profileQuery [05/Apr/2004:16:31:59 0 +869 URI Date Seconds Fil +e Size ----------------- --------------------- ------- --- +------ /profileQuery [05/Apr/2004:16:32:53 0 +873 URI Date Seconds Fil +e Size ----------------- --------------------- ------- --- +------ /profileQuery [05/Apr/2004:16:33:47 1 +871
i'd like it to look more like this:
URI Date Seconds Fil +e Size /profileQuery [05/Apr/2004:16:36:31 1 +869 /profileQuery [05/Apr/2004:16:37:25 1 +893
i've tried using the block formatting for the form but its not working. my question is.. does my input have to be in block format before this will work?

Replies are listed 'Best First'.
Re: Easy question i'm sure about formatting
by DamnDirtyApe (Curate) on Apr 06, 2004 at 00:44 UTC

    mvram, please post your code thus far. What your attempting should be a trivial task, so showing us exactly what you've got so far will make it easy for us to help.


    _______________
    DamnDirtyApe
    Those who know that they are profound strive for clarity. Those who
    would like to seem profound to the crowd strive for obscurity.
                --Friedrich Nietzsche
      here is my form:
      format STDOUT = URI Date Seconds Fil +e Size ----------------- --------------------- ------- --- +------ @<<<<<<<<<<<<<<<<< @|||||||||||||||||||||||||||| @|||||| @|| +|||||| $URL, $Date, $Time, $Si +ze, . write STDOUT;
      as for the question of being easy or not, i've yet to find much documentation about this with the exception of Perl 6.
        Now, I'm just going to generate some bunk data to give you the idea. But I think this is what you want.
        I've never figured out a good way to make this type of code indent well for readability, so you'll have to deal with that yourself.
        my @URI = ("/profileQuery1","/profileQuery2","/profileQuery3"); my @DATE = ("05/Apr/2004:16:33:02", "05/Apr/2004:16:36:31", "05/Apr/20 +04:16:37:48"); my @FILESIZE = ("889","224", "345"); my $i = 0; while($i <= $#URI){ format top = URI DATE Seconds Filesize -------------- -------------------------- ------- ------- . format STDOUT = @<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<< @<<<<<<< $URI[$i],$DATE[$i],"1", $FILESIZE[$i] . write; $i++; }

        This code outputs

        URI                 DATE                   Seconds  Filesize
        -------------- --------------------------  -------  --------
        /profileQuery1   05/Apr/2004:16:33:02        1        889
        /profileQuery2   05/Apr/2004:16:36:31        1        224
        /profileQuery3   05/Apr/2004:16:37:48        1        345
        


        And I'm fairly sure that's what you wanted.
Re: Easy question i'm sure about formatting
by esskar (Deacon) on Apr 06, 2004 at 00:18 UTC
    beat me if i'm stupid but just do not print the ----- ???
      indeed. it was a copy error on my part the "-----" will still be there
Re: Easy question i'm sure about formatting
by jaco (Pilgrim) on Apr 06, 2004 at 00:34 UTC
    I'm curious as to the code behind this.

    Are you using format and write or are you just using print statements?
Re: Easy question i'm sure about formatting
by Abigail-II (Bishop) on Apr 06, 2004 at 07:09 UTC
    I've got to ask this. If you think it's an "easy question", why do you ask here instead of figuring out yourself? It should be easy, and you might learn something.

    Besides, without showing us what you've done so far, it's going to be guesswork.

    Abigail