in reply to Re^2: split a line into 2 variables and store in SQL
in thread split a line into 2 variables and store in SQL

AFAICS, you wouldn't expect a statement of the form apple banana to work as its clearly not valid SQL - unless there's something I've missed in the postings thus far ...

Maybe some sample output, failing though it is, would help us (to help you)

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^4: split a line into 2 variables and store in SQL
by sharan (Acolyte) on Jan 23, 2009 at 11:13 UTC
    Hi Bloodnok, Thanks for your reply...I have a file in which i have data..
    word1 := word2; word3 <= word4; word5 <= word6;
    And i have to read this... such that i read word1, word3, word 5.. etc in same variable so that i should be able to transfer this data into a SQL table. And as far as i knw, we can transfer any data into the sql. Thanking you,
      ...but you can only update an SQL table using an SQL UPDATE statement e.g.
      UPDATE table SET foo = bar WHERE condition
      browsing SQL should start you off.

      BTW, you do realise that the split you perform won't work with word1 := word2; since the value you split on doesn't exist, try /\s*.=\s/* as the regex - in that way, you'll remove white space either side of the tokens you actually want.

      Alternatively, just use vanilla split and use the 1st and 3rd elements of the resulting array e.g.

      while (<>) { my @args = split; # Now use $args[0] & $args[2] as appropriate . . }

      A user level that continues to overstate my experience :-))