Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Spaces Between Chars While Reading File

by igelkott (Priest)
on Aug 01, 2008 at 13:33 UTC ( #701693=note: print w/replies, xml ) Need Help??


in reply to Spaces Between Chars While Reading File

Using ".+" in a regular expression is generally going to lead to trouble.

Given the excel source and desired removal of quotes, it seems rather likely that you're reading from a CSV file. As such, you might consider using Text::CSV to save you from the complications of the format.

Alternatively, you might even consider reading from the excel file directly with Spreadsheet::ParseExcel, though I must admit that I've never used it on 2007.

  • Comment on Re: Spaces Between Chars While Reading File

Replies are listed 'Best First'.
Re^2: Spaces Between Chars While Reading File
by almut (Canon) on Aug 01, 2008 at 13:47 UTC
    Using ".+" in a regular expression is generally going to lead to trouble.

    Why is that (generally)? — I mean, it all depends on what you want to achieve, doesn't it?

      "Greedily garble everything" is rarely what you want to achieve. In the OP case, it will change
      "ab", "abc", "cde"
      into
      ab", "abc", "cde
      which is (possibly) not the intended result. The ideal would be
      s/"([^"]+)"/$1/g
      that would yield
      ab, abc, cde
      []s, HTH, Massa (κς,πμ,πλ)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://701693]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-04-18 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?