Two things: (1) the error message says you're trying to treat a string as a number. ne tests for unequal *strings*, while != tests for unequal *numbers*.

Perl (which, as you're finding out, is Not Java =) provides the defined() function to test for null values. So write that as

while (defined ( my $line = <INPUT>) ) {

Actually, go ahead and try

while ($line = <INPUT>) {

as even blank lines contain newlines, and so evaluate to true.

(2) it makes more sense to write parseDown1 as a subroutine that accepts $filename as an argument than as something that expects a global to be set. Here it's not causing problems but it's not a good design to use in any script you'll keep (or cadge code from!).

sub parseDown { my $filename = shift @_; # or $_[0] or just plain shift # rest of sub }

(3) use strict and warnings (-w in pre-5.6.0 Perl). Doing this will require that you declare your variables with my2 and pay attention to scope. This is a Good thing.

(4) don't blindly use $1 and $2 without checking to see whether your regex matched. If it doesn't weird things can happen. Instead, do this:

if (my ($tmp_dir, $file) = $line =~ m%(.*)\\(.*)% ) { # do the rest of the stuff } else { warn "$line has incorrect format!\n"; }

(5) I can't count.

HTH

1 That spelling, and the != null test, suggest you're coming from a Java background. Apologies if that's incorrect.
2(update) or our (5.6.0) or use vars. Included for completeness. Ignore this for now, I just don't want to say anything false.


In reply to (arturo): Re: Really dumb question... ('ne' not working) by arturo
in thread Really dumb question... ('ne' not working) by Apathy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.