从 Perl 迁移到 Powershell 有没有好的参考资料? [英] Are there good references for moving from Perl to Powershell?

查看:39
本文介绍了从 Perl 迁移到 Powershell 有没有好的参考资料?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想这么说,但是 powershell 真的很烦我.我似乎无法理解它.我有一本关于这个主题的 O'Reilly 书,我可以看到如何做一些非常强大的东西——这是我似乎无法正确做的简单的东西.

I hate to say it, but powershell is really annoying me. I just cannot seem to get my mind around it. I have an O'Reilly book on the topic, and I can see how to do some extremely powerful stuff -- it's the easy stuff I can't seem to get right.

for /F %x in ('dir EXPRESSION') do @(
   arbitrary-action %x
)

在 Perl 中:

@foo=glob("*");
foreach (@foo)
{
   arbitrary-command $_ ;
}

在 Powershell 中:

I'm dumbfounded.  I can't seem to get it right.

但我不是发送这篇文章,所以有人可以告诉我答案.我不想回答这个简单的问题.我想知道如何解决这个问题,而 Google/Bing 搜索并没有削减它.获取帮助功能是 powershell 很好,但仍然不够.

But I am not sending this post so somebody can tell me the answer. I don't want the answer to this simple question. I want to know how to figure it out, and Google/Bing searches are just not cutting it. The get-help functionality is powershell is nice, but it's still not enough.

我已经编程 20 年了.我已经学习了 BASIC、Fortran、C、Pascal、Perl、C++、C#、BASH 和 CMD 脚本......而且我从来没有遇到过使用 Powershell 时遇到的问题.

I've been programming for 20 years. I've learned BASIC, Fortran, C, Pascal, Perl, C++, C#, BASH and CMD scripting...And never have I had the trouble I'm having with Powershell.

是否没有从 Perl 迁移到 Powershell 的参考资料?发布似乎是一件很简单的事情,但我还没有找到.

Are there no references "out there" for migrating from Perl to Powershell? It seems like such a straightforward thing to publish, but I have yet to find one.

任何帮助将不胜感激.谢谢.

更新:

Any help would be appreciated. Thanks.

Update:

好的,所以这可能不是最好的发布示例.

Okay, so maybe this wasn't the best example to post.

我认为当我交互式地尝试 gci 时,我得到了一个目录列表,我想要的是一个字符串数组.

I think I was thrown off by the fact that when I tried gci interactively, I got a directory listing, where what I wanted was an array of strings.

我坚定了信念并尝试了:
foreach ($foo in gci "*") {回声 $foo;}

I took a leap of faith and tried:
foreach ($foo in gci "*") { echo $foo; }

是的,它奏效了.是的,我可以继续进行搜索以解决问题.我想我只是希望找到一个利用与我已经知道的语言的相似性的指南.我知道 Microsoft 发布了 VBScript-to-Powershell 指南,所以我希望有一个 Perl 等价物.

And yeah, it worked. And yes, I can continue to do searches to piece my way through. I guess I was just hoping to find a guide that makes use of the similarity to languages I already know. I know that Microsoft published a VBScript-to-Powershell guide, so I was hoping for a Perl equivalent.


再次感谢

推荐答案

我从未见过这样的指南.我见过一些可以帮助人们从 VBScript 转向 PowerShell 的方法.

I've never seen such a guide. I've seen something to help people going from VBScript to PowerShell.

Bruce Payette 的 PowerShell in Action 确实有几页介绍了 PowerShell 与 X 脚本语言,但这并不能用作转换指南.

Bruce Payette's PowerShell in Action does have a few pages on PowerShell vs X scripting language, but that won't cut it for a conversion guide.

现在,有一个网站有多种语言的各种结构,因此提供了一个任务,然后根据社区的答案用各种语言解决它......任何人都知道我在谈论?

Now, there was a site out there that had all kinds of constructs in multiple languages, thus providing a task, and then going about solving it in all kinds of languages based on answers from the community... Anyone know what I'm talking about?

这篇关于从 Perl 迁移到 Powershell 有没有好的参考资料?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆