even if I am not quite sure why. As my file is encoded in UTF8, how am I supposed to open it correctly and read it?
What output does this program produce for you? After being packed with pp?
#!/usr/bin/perl -- use strict; use warnings; use Data::Dump qw/ dd pp /; open my($fh),'<:encoding(UTF-8)', 'deleteme.txt' or die $!; my $file = <$fh>; close $fh; my $dsn = "dbi:SQLite:dbname=$file"; # extract dbi:driver prefix from $dsn into $1 $dsn =~ s/^dbi:(\w*?)(?:\((.*?)\))?://i or '' =~ /()/; # ensure $1 etc are empty if match fails my $driver_attrib_spec = $2 || ''; # Set $driver. Old style driver, if specified, overrides new dsn style +. my $driver = $1 or die pp( $file, $dsn, [ $1, $2 ] ); dd( $file, $dsn, [ $1, $2 ] );
In reply to Re^5: Can't connect to data source 'DBI:SQLite:\C:\Users\DON\Desktop\data.db
by Anonymous Monk
in thread pp concatenate path
by IB2017
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |