User Profile

Collapse

Profile Sidebar

Collapse
dafydd
dafydd
Last Activity: Aug 12 '09, 04:23 AM
Joined: Jan 25 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • dafydd
    replied to splitting a file by a character
    in Perl
    forgot to clarify the code's purpose



    I'm sorry I forgot to mention in the title what those sql statements were. I'm not fetching anything from the database using this code. I'm issuing statements to create sql tables and such to postgresql using the DBI....
    See more | Go to post

    Leave a comment:


  • dafydd
    replied to splitting a file by a character
    in Perl
    solved

    I've solved this problem since I last posted here. Thanks for the response though. Here's what I used:
    Code:
    my $line = "";
    my $currentCommand = "";
    while(defined($line = <SCHEMA>)) {
    	$line =~ s/[\t\n]*//g;
    	# append to the current sql command
    	$currentCommand = $currentCommand . $line;
    	if($line =~ /;/) {
    		# this line ends an sql command,
    ...
    See more | Go to post
    Last edited by dafydd; May 4 '09, 05:43 AM. Reason: said thanks

    Leave a comment:


  • dafydd
    started a topic splitting a file by a character
    in Perl

    splitting a file by a character

    I got a multiline SQL file that I would like to split by ; and read into an array. However when I try to do
    Code:
    my @array = split(";", <FH>);
    and iterate over each element I get just the first line of the SQL file.

    Does anyone know how they would get the array of sql statements (and no new lines)?
    See more | Go to post
    Last edited by numberwhun; May 13 '09, 07:19 PM. Reason: Please use code tags!
No activity results to display
Show More
Working...