该脚本的目的是处理文件中的所有单词并输出最多出现的所有单词.因此,如果有3个单词每次出现10次,程序应输出所有单词.
脚本现在运行了,感谢我在这里得到的一些提示.但是,它不处理大型文本文件(即新约).我不确定这是我的错还是仅限于代码.我相信该程序还有其他几个问题,所以任何帮助都将不胜感激.
#!/usr/bin/perl -w
require 5.10.0;
print "Your file: " . $ARGV[0] . "\n";
#Make sure there is only one argument
if ($#ARGV == 0){
#Make sure the argument is actually a file
if (-f $ARGV[0]){
%wordHash = (); #New hash to match words with word counts
$file=$ARGV[0]; #Stores value of argument
open(FILE, $file) or die "File not opened correctly.";
#Process through each line of the file
while (<FILE>){
chomp;
#Delimits on any non-alphanumeric
@words=split(/[^a-zA-Z0-9]/,$_);
$wordSize = @words;
#Put all …Run Code Online (Sandbox Code Playgroud) 我正在运行SQL Server 2008(否则我会使用Try_Parse)并且我需要在非空的情况下将字段转换为数字.如果该字段为空,则应返回空字符串或NULL.我更喜欢该字段是作为数字存储在数据库中,但我目前无法控制它.
这是我尝试过的:
SELECT CASE WHEN AccountNumber='' THEN '' ELSE CAST(AccountNumber AS bigint) END AS AccountNumber FROM Accounts
要么
SELECT CASE WHEN CAST(AccountNumber AS bigint)=0 THEN '' ELSE CAST(AccountNumber AS bigint) END AS AccountNumber FROM Accounts
但是这两个都为空帐号带来了0.我觉得这应该是可能的,但我会疯狂地试图解决它!谢谢!