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

I have textfiles created with Qbasic, When viewed, the DATE command has printed "02-14-2004". When I read in that textfile and try to compare "02-14-2004" to a scalar for date created in Perl, the dates do not match because of the quotation marks. Adding quotes to the scalar will not work because there are other variables in the text file that I also need.
  • Comment on How do I remove quotation marks from DOS textfile

Replies are listed 'Best First'.
Re: How do I remove quotation marks from DOS textfile
by CountZero (Bishop) on Feb 14, 2004 at 11:12 UTC
    It is a bit difficult to give you a straight answer as you did not give an example of your textfile.

    If your textfile is some form of a CSV-file, you could use one of the CSV modules to deal with it (they will handle the "unquoting" for you).

    You could also use tr/"//d to delete all double quotes in your textfile or use a regex m/"(\d{2}-\d{2}-\d{4})"/ to extract the date without the quotes.

    Warning: untested code as I have no Perl on the machine I'm writing this on and I have no real data to work with.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law