How to recognize accented characters upper and lower case
I have a perl script that parses accented characters and works well in Windows 2000 (that was installed in brazilian language). In MacOS X the "i" flag doesn't recognize the accented characters in uppercase. The script has the "setlocale" statment and I also put the brazilian language as the default in bash_profile, as shown bellow. What am I missing? TIA Newton Furia -- In the script -- #!/usr/bin/perl -w use POSIX qw(locale_h); setlocale(LC_CTYPE, "pt_BR.ISO8859-1"); use locale; while (<> ) { s/(Instrução|Resolução)[^\d]+([\d\.]+)/\u\L$1 $2/gi; print $_; } --- In the bash_profile: --- LC_ALL=pt_BR.ISO8859-1 export LC_ALL
seperate file
Hi all, I'm new on perl. I need to separate a huge file to small files. It has three columns. If first column is a number , use this number as a file name (i. e., 260.dat and 300.dat for following sample), and then writing column 2 and columns 3 to this file. Following is a sample such file: 26005000 205300 405500 806000 1005500 300 05100 205200 405500 805600 1005800 Please help. John
Re: seperate file
I need to separate a huge file to small files. It has three columns. If first column is a number , use this number as a file name (i. e., 260.dat and 300.dat for following sample), and then writing column 2 and columns 3 to this file. You didn't say whether you want to preserve anything in the spacing of the input file. Assuming not, the attached will do the job. Neil split-files.pl Description: Binary data
Access External Hard Drive - Local and Network
Hi all, OK, this is kind of part two of my backup project. How do I access an external (or secondary internal, for that matter) hard drive within perl? I tried the following: . . copy ("/Users/xx/Documents/db.txt","/Fire1/db.txt.bak"); . . That didn't work. How do I access the external drive? As well, this question would seg into accessing a PC drive on my network. I was guessing all I would need is the pathway, but I'm thinking that I need to use a module... or something. This may seem simple but it's new for me. Thanks for you help. Mark
Access External Hard Drive - Local and Network
OK... the "Fire1" is the name of my external hard drive. Forgot to mention that. Sorry, Mark
Re: Access External Hard Drive - Local and Network
Thanks Jeff and Joseph, You're right. It's in /Volumes/ I'm not on the network right now, but I'm presuming that the PC drive(s) would appear in the /Volumes/ directory as well. Can you confirm that? Thanks, Mark On Apr 29, 2004, at 9:14 AM, Joseph Alotta wrote: Mark, Look around in /Volumes/... for something that looks like Fire1. Joe. On Apr 29, 2004, at 10:57 AM, Mark Wheeler wrote: Hi all, OK, this is kind of part two of my backup project. How do I access an external (or secondary internal, for that matter) hard drive within perl? I tried the following: . . copy ("/Users/xx/Documents/db.txt","/Fire1/db.txt.bak"); . . That didn't work. How do I access the external drive? As well, this question would seg into accessing a PC drive on my network. I was guessing all I would need is the pathway, but I'm thinking that I need to use a module... or something. This may seem simple but it's new for me. Thanks for you help. Mark
Re: Access External Hard Drive - Local and Network
On Thu, 29 Apr 2004, Mark Wheeler wrote: > I'm not on the network right now, but I'm presuming that the PC > drive(s) would appear in the /Volumes/ directory as well. Can you > confirm that? Yes -- as a general rule, OSX mounts all filesystems other than the one you booted from under the /Volumes tree. This includes external drives, other locally attached physical discs (CD/DVD drives, Zip drives, etc), network shared drives (AFP, Samba, FTP, WebDAV, etc), and mounted disc images. I may have omitted some, but that gives you the idea. The only way this is typically overridden is when, for example, you have a NFS mounted /home directory tree, but that's probably more common with bigger networks than home machines (I assume). That or when you have an alias or symlink from /Volumes/$foo to /path/to/$bar, but even then it's not that /Volumes isn't being used, it's just being supplemented. So as the earlier mail you got suggested, everything is in /Volumes. -- Chris Devers
Re: Access External Hard Drive - Local and Network
Perfect. Thanks so much for your help. I'll implement the directory changes and we should be good to go. Thanks, Mark On Apr 29, 2004, at 9:35 AM, Chris Devers wrote: On Thu, 29 Apr 2004, Mark Wheeler wrote: I'm not on the network right now, but I'm presuming that the PC drive(s) would appear in the /Volumes/ directory as well. Can you confirm that? Yes -- as a general rule, OSX mounts all filesystems other than the one you booted from under the /Volumes tree. This includes external drives, other locally attached physical discs (CD/DVD drives, Zip drives, etc), network shared drives (AFP, Samba, FTP, WebDAV, etc), and mounted disc images. I may have omitted some, but that gives you the idea. The only way this is typically overridden is when, for example, you have a NFS mounted /home directory tree, but that's probably more common with bigger networks than home machines (I assume). That or when you have an alias or symlink from /Volumes/$foo to /path/to/$bar, but even then it's not that /Volumes isn't being used, it's just being supplemented. So as the earlier mail you got suggested, everything is in /Volumes. -- Chris Devers
Re: seperate file
On 30 Apr 2004, at 12:20 AM, zunsheng Jiao wrote: Hi all, I'm new on perl. I need to separate a huge file to small files. It has three columns. If first column is a number , use this number as a file name (i. e., 260.dat and 300.dat for following sample), and then writing column 2 and columns 3 to this file. Following is a sample such file: 26005000 205300 405500 806000 1005500 300 05100 205200 405500 805600 1005800 Please help. John If your data is tab delimited the following will work. If not the split line needs to be changed depending on how your data is arranged. # Go through each line of the data foreach $line() { # Split the line at whitespace my ($file, $col1, $col2) = split(/\s+/,$line); # If there's something in the $file column, it's a new file if ($file) { # close the current file (but don't die if there is none) eval{ close(FILE) }; # open the new file or die if we can't open(FILE, ">/Users/rickm/Desktop/test/$file.dat") or die("I can't open $file.dat: $!"); } # Write the data to the file print FILE $col1 . "\t" . $col2 . "\n"; } # close the latest file: eval{ close(FILE) }; __DATA__ 260 0 5000 205300 405500 806000 1005500 300 05100 205200 405500 805600 1005800 Senior Developer PrintSupply - Print Procurement & Supply Management 18 Greenaway Street VIC 3105 Tel: (03) 9850 3255 Fx: (03) 9850 3277 http://www.printsupply.com.au/
LC_ALL for daemons
I'm sure I've seen a thread on this, but a casual search didn't turn it up. (I'm always looking in the wrong places.) When I'm logged in as a user, I can set the appropriate environmen variables, but when a daemon is running, where is it going to get them? Joel Rees
"comparison always false" is a problem or not?
My experience is that this kind of thing tends to lead to dead code or endless loops. Do I need to dig in and find the macro declaration and see if I can fix it? warning: comparison is always false due to limited range of data type regcomp.c:724 pp_sys.c:302 byterun.c:898 re_comp.c:724 Joel Rees