Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] array error.

Expand Messages
  • gopi ramya
    Hi Ramesh , please ne instead of != that surely work for u and give the reply if any thing Thanks && Regrads GOPI . R +91 94435 92202 ... From: Ramesh
    Message 1 of 3 , May 1, 2007
      Hi Ramesh ,

      please "ne" instead of "!=" that surely work for u
      and give the reply if any thing


      Thanks && Regrads
      GOPI . R
      +91 94435 92202

      ----- Original Message ----
      From: Ramesh Polepalli <ramesh.polepalli@...>
      To: perl-beginner@yahoogroups.com
      Sent: Tuesday, May 1, 2007 10:48:41 AM
      Subject: RE: [PBML] array error.













      Use string comparison "ne" instead of numeric comparison "!=".



      This should solve your problem as you are interested to skip "#".



      ____________ _________ _________ __



      From: perl-beginner@ yahoogroups. com

      [mailto:perl-beginner@ yahoogroups. com] On Behalf Of Mirza Abdullah Jan

      Sent: Monday, April 30, 2007 6:34 PM

      To: perl-beginner@ yahoogroups. com

      Subject: [PBML] array error.



      This is my code........ ..



      # !/usr/local/ bin/perl -w



      use warnings;

      # use strict;

      #use diagnostics -verbose;



      my $datafile = "data.txt";

      open(FILEHANDLE, "$datafile" );

      @fdata = <FILEHANDLE> ;



      $tsize = (@fdata);

      my $v=0;

      my $u=0;



      for($u=0;$u< =$tsize;$ u++)

      {



      if($fdata[$u] != '#')

      {

      $datain[$v] = $fdata[$u];



      $v = $v + 1;



      }

      else

      {

      $u = $u+1;

      }

      }



      When is execute this code , i get following error....... .

      Argument "72795^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "72850^I232\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "72913^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "72961^I234\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73022^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73082^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73145^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73205^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73274^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73324^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73391^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73442^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73511^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73570^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73633^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73693^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73750^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73814^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73872^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73929^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "73982^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74053^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74107^I232\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74161^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74232^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74286^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74352^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74414^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74471^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74522^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74593^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74646^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74707^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74766^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74830^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74890^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.

      Argument "74942^I231\ n" isn't numeric in numeric ne (!=) at pinget1.pl

      line 206, <FILEHANDLE> line 1466.



      Please help me how to fiugre out this error....... my data file contain

      is like this.



      12 230

      45 250

      75 250



      and so on.......... ...



      ------------ --------- --------- ---

      Ahhh...imagining that irresistible "new car" smell?

      Check outnew cars at Yahoo! Autos.



      [Non-text portions of this message have been removed]



      Ramesh Polepalli



      mFormation Technologies Inc.

      Direct Line: +91 80 6620 5939

      Switchboard: +91 80 6620 5900



      http://www.mformati on.com





      Visit WWW.MFORMATION. COM and see how the MFORMATION SERVICE MANAGER can help you to transform your business.



      [Non-text portions of this message have been removed]














      <!--

      #ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
      #ygrp-mlmsg table {font-size:inherit;font:100%;}
      #ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
      #ygrp-mlmsg pre, code {font:115% monospace;}
      #ygrp-mlmsg * {line-height:1.22em;}
      #ygrp-text{
      font-family:Georgia;
      }
      #ygrp-text p{
      margin:0 0 1em 0;}
      #ygrp-tpmsgs{
      font-family:Arial;
      clear:both;}
      #ygrp-vitnav{
      padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
      #ygrp-vitnav a{
      padding:0 1px;}
      #ygrp-actbar{
      clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
      #ygrp-actbar .left{
      float:left;white-space:nowrap;}
      .bld{font-weight:bold;}
      #ygrp-grft{
      font-family:Verdana;font-size:77%;padding:15px 0;}
      #ygrp-ft{
      font-family:verdana;font-size:77%;border-top:1px solid #666;
      padding:5px 0;
      }
      #ygrp-mlmsg #logo{
      padding-bottom:10px;}

      #ygrp-vital{
      background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
      #ygrp-vital #vithd{
      font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
      #ygrp-vital ul{
      padding:0;margin:2px 0;}
      #ygrp-vital ul li{
      list-style-type:none;clear:both;border:1px solid #e0ecee;
      }
      #ygrp-vital ul li .ct{
      font-weight:bold;color:#ff7900;float:right;width:2em;text-align:right;padding-right:.5em;}
      #ygrp-vital ul li .cat{
      font-weight:bold;}
      #ygrp-vital a {
      text-decoration:none;}

      #ygrp-vital a:hover{
      text-decoration:underline;}

      #ygrp-sponsor #hd{
      color:#999;font-size:77%;}
      #ygrp-sponsor #ov{
      padding:6px 13px;background-color:#e0ecee;margin-bottom:20px;}
      #ygrp-sponsor #ov ul{
      padding:0 0 0 8px;margin:0;}
      #ygrp-sponsor #ov li{
      list-style-type:square;padding:6px 0;font-size:77%;}
      #ygrp-sponsor #ov li a{
      text-decoration:none;font-size:130%;}
      #ygrp-sponsor #nc {
      background-color:#eee;margin-bottom:20px;padding:0 8px;}
      #ygrp-sponsor .ad{
      padding:8px 0;}
      #ygrp-sponsor .ad #hd1{
      font-family:Arial;font-weight:bold;color:#628c2a;font-size:100%;line-height:122%;}
      #ygrp-sponsor .ad a{
      text-decoration:none;}
      #ygrp-sponsor .ad a:hover{
      text-decoration:underline;}
      #ygrp-sponsor .ad p{
      margin:0;}
      o {font-size:0;}
      .MsoNormal {
      margin:0 0 0 0;}
      #ygrp-text tt{
      font-size:120%;}
      blockquote{margin:0 0 0 4px;}
      .replbq {margin:4;}
      -->







      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

      [Non-text portions of this message have been removed]
    • Mike Southern
      This is like watching whales trying to tie knots. There are many problems with the attempted solution to this problem. And even though the your objective
      Message 2 of 3 , May 1, 2007
        This is like watching whales trying to tie knots.

        There are many problems with the attempted solution to this problem. And
        even though the your objective itself is not clear, you are making errors
        right at the start by not dealing with your datafile correctly.

        It looks like you are opening and assigning the filehandle. By getting the
        size (record count) of the file, you're then processing it line by line but
        there are better ways to do this than counting through the array alements.

        > open(FILEHANDLE, "$datafile" );
        > @fdata = <FILEHANDLE> ;
        > $tsize = (@fdata);

        Even this would be more manageable:

        foreach $line(@fdata) {
        # ... Do stuff;
        }

        But then the data in the file should be processed before you attempt to work
        with it. For example, the line
        if($fdata[$u] != '#') is asking:
        if "72795^I230\n" is not equal to "#"

        The != is not appropriate with the "#" as "#" is not numeric. But do you
        really mean to check for a "#"? I see no "#" in the datafile example. Are
        you clear about what you are checking for? For example, if you want to check
        that the value does not *start* with "#" then the code would be very
        different.

        > Argument "72795^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl


        Also, are you aware that "72795^I230\n" was originally dumped from its
        source as "72795 tab 230 newline"? The ^I (ascii char 9) is a tab character.

        This means you are analysing data that possibly contains irrelevant
        information. That may affect your results. It would be probably important to
        have a function that pre-processes each line before you use it.

        Then there is that $fdata[$u] possibly should be @fdata[$u]? And
        inconsistent layout means it's difficult to read. $u=$u+1 and $v = $v + 1
        should be consistent and would be better as $u++ $v++

        You are also incrementing $u in two places

        1) > for($u=0;$u< =$tsize;$u++)
        2) > $u = $u+1;

        I can't see the reason for that.

        I think the != error is the least of your problems.




        On 5/1/07 7:12 AM, gopi ramya at gopi_nath28@... wrote:

        > Hi Ramesh ,
        >
        > please "ne" instead of "!=" that surely work for u
        > and give the reply if any thing
        >
        >
        > ----- Original Message ----
        > From: Ramesh Polepalli <ramesh.polepalli@...>
        > To: perl-beginner@yahoogroups.com
        > Sent: Tuesday, May 1, 2007 10:48:41 AM
        > Subject: RE: [PBML] array error.
        >
        > Use string comparison "ne" instead of numeric comparison "!=".
        >
        > This should solve your problem as you are interested to skip "#".
        >
        > [mailto:perl-beginner@ yahoogroups. com] On Behalf Of Mirza Abdullah Jan
        >
        > Sent: Monday, April 30, 2007 6:34 PM
        >
        > To: perl-beginner@ yahoogroups. com
        >
        > Subject: [PBML] array error.
        >
        >
        >
        > This is my code........ ..
        >
        > # !/usr/local/ bin/perl -w

        > use warnings;
        >
        > # use strict;
        >
        > #use diagnostics -verbose;
        >
        >
        >
        > my $datafile = "data.txt";
        >
        > open(FILEHANDLE, "$datafile" );
        >
        > @fdata = <FILEHANDLE> ;
        >
        >
        >
        > $tsize = (@fdata);
        >
        > my $v=0;
        >
        > my $u=0;
        >
        >
        >
        > for($u=0;$u< =$tsize;$ u++)
        >
        > {
        >
        >
        >
        > if($fdata[$u] != '#')
        >
        > {
        >
        > $datain[$v] = $fdata[$u];
        >
        >
        >
        > $v = $v + 1;
        >
        >
        >
        > }
        >
        > else
        >
        > {
        >
        > $u = $u+1;
        >
        > }
        >
        > }
        >
        >
        >
        > When is execute this code , i get following error....... .
        >
        > Argument "72795^I230\ n" isn't numeric in numeric ne (!=) at pinget1.pl
        >
        > line 206, <FILEHANDLE> line 1466.
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.