Professional Web Applications Themes

general question about variable and array - PERL Beginners

Hi, how do I insert the values of variables of a function in a array which ist out of the scope of the function, e.g I've a find function and I want insert the values results of the find function in an array: ---------------------------------------- my array; sub wanted { if(-f and /^aoWebCGI\.htm\z/s) { my $file = $_; open(FILE, "<$file"); my $data = <FILE>; my $te = new HTML::TableExtract( depth => 0); $te->p($data); foreach my $ts ($te->table_states) { foreach my $row ($ts->rows){ if ($row->[0] =~ /Anforderungen/){ my $anforderungen = $row->[1]; push(count, $row->[1]); ... process the data and insert this in array ...

  1. #1

    Default general question about variable and array

    Hi,

    how do I insert the values of variables of a function in a array which
    ist out of the scope of the function, e.g

    I've a find function and I want insert the values results of the find
    function in an array:

    ----------------------------------------
    my array;

    sub wanted {
    if(-f and /^aoWebCGI\.htm\z/s) {
    my $file = $_;
    open(FILE, "<$file");
    my $data = <FILE>;

    my $te = new HTML::TableExtract( depth => 0);
    $te->p($data);

    foreach my $ts ($te->table_states) {
    foreach my $row ($ts->rows){
    if ($row->[0] =~ /Anforderungen/){
    my $anforderungen = $row->[1];
    push(count, $row->[1]);
    ... process the data and insert this in array
    ----------------------------------------


    using "print Dumper(\array);
    I've no results, the array is empty.
    If I place array inside the sub routine then array is full why and how
    can solve this problem?

    Xaver Biton
    Xaver Guest

  2. #2

    Default Re: general question about variable and array


    "Xaver Biton" <de> wrote in message
    news:develooper.com... 

    I'd say either make array global, or return(\array);


    ./Rob Guest

  3. #3

    Default Re: general question about variable and array

    On Wed, 01 Sep 2004 22:34:05 +0200, Xaver Biton wrote:
     

    [ snip incomplete code ]
     
    You've not provided complete code (esp. the part assigning data to array)
    so I can't possibly point you in the right direction.

    You may also want to have a look at passing values to subroutines, either
    by reference or by value.

    Chris.

    Chris Guest

Similar Threads

  1. #39251 [NEW]: variable variable class array property is read only
    By taskfreak at gmail dot com in forum PHP Bugs
    Replies: 1
    Last Post: October 25th, 07:08 AM
  2. Hey all, got a general question
    By maarten@adobeforums.com in forum Adobe Indesign Macintosh
    Replies: 9
    Last Post: September 26th, 08:10 PM
  3. General PHP question
    By John Bonam in forum PHP Development
    Replies: 0
    Last Post: September 3rd, 02:54 PM
  4. general question
    By sfk in forum Oracle Server
    Replies: 3
    Last Post: December 28th, 03:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139